Posts

Asp.net and C# Interview Qustions

ASP.NET 1. Where machine.config resides? 32-bit % windir % \Microsoft . NET\Framework\[version ] \config\machine . config 64-bit % windir % \Microsoft . NET\Framework64\[version ] \config\machine . config [version]  should be equal to  v1.0.3705 ,  v1.1.4322 ,  v2.0.50727  or  v4.0.30319 . 2. How can we prevent browser from caching an ASPX page? We can SetNoStore on HttpCachePolicy object exposed by the Response object’s Cache property: 1 2 Response . Cache . SetNoStore ( ) ; Response . Write ( DateTime . Now . ToLongTimeString ( ) ) ; 3. Page Life cycle stages? Stage Description Page request The page request occurs before the page life cycle begins. When the page is requested by a user, ASP.NET determines whether the page needs to be parsed and compiled (therefore beginning the life of a page), or whether a cached version of the page can be sent in response without running the page. Start In the ...

How to get device info IMEI programmatically in xamarin android

You'll need the following permission in your  AndroidManifest.xml : <uses-permission android:name="android.permission.READ_PHONE_STATE" /> in order to do this. You want to call  android.telephony.TelephonyManager.getDeviceId() . This will return whatever string uniquely identifies the device (IMEI for GSM, MEID for CDMA). Code Android.Telephony.TelephonyManager mTelephonyMgr;             mTelephonyMgr = (Android.Telephony.TelephonyManager)GetSystemService(TelephonyService);   //IMEI number    String m_deviceId = mTelephonyMgr.DeviceId;

Remove all cookies using jquery

you can download cookies plugin from  https://plugins.jquery.com/cookie/ and use this script var cookies = $ . cookie (); for ( var cookie in cookies ) { $ . removeCookie ( cookie ); }

Java.Lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()

Code Toast toast = Toast . makeText ( mContext , "Something" , ToastLength . LENGTH_SHORT ); Exception Java.Lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() Reason Android basically works on two thread types namely UI thread and background thread. Toast cannot be called from a non-UI thread. Solution RunOnUiThread(() => { Toast.MakeText(this, "Something", ToastLength.Short).Show(); });

How Pass Parameter to ThreadStart in C#

There are two ways to accomplish it. 1.  Thread thread = new Thread (() => download ( parm1 )); thread . Start (); 2. Thread thread = new Thread ( new ParametrizedThreadStart ( func1 )); thread. Start (parm 1 );

Create Alert Dialog in Xamarin Android

1. Using AlertDialog in Xamarin.Android AlertDialog  is the subclass of  Dialog  that can display one, two or three buttons. If you only want to display a String in this dialog box, use the  SetMessage()  method. The following code snippet can be used to create a simple AlertDialog with two buttons Delete and Cancel. //set alert for executing the task AlertDialog.Builder alert = new AlertDialog.Builder (this); alert.SetTitle ("Confirm delete"); alert.SetMessage ("Lorem ipsum dolor sit amet, consectetuer adipiscing elit."); alert.SetPositiveButton ("Delete", (senderAlert, args) => { Toast.MakeText(this ,"Deleted!" , ToastLength.Short).Show(); }); alert.SetNegativeButton ("Cancel", (senderAlert, args) => { Toast.MakeText(this ,"Cancelled!" , ToastLength.Short).Show(); }); Dialog dialog = alert.Create(); dialog.Sho...