Write a javascript function:
function disableBackButton()
{
window.history.forward();
}
Call it on load of body in html.
i.e. onload="disableBackButton()"
Friday, March 12, 2010
String Manipulations
// Concatenation of the strings.
string start = "This is a ";
string end = "concatenated string";
string result= start + end;
// Inserting Strings into Strings
string first= "Please check this code.";
string second= "understand";
Console.WriteLine(first.Insert(24, second));
// Search and Replace
string sample = "The good programming.";
string result = sample.Replace("good", "excellent"));
// Copying Strings
string myString= "The ultimate programming code.";
string result = string.Copy(myString);
// Extracting Text from a String
string sample = "The quick start tutorial is a must.";
string result = sample.Substring(4); //result will be "quick start tutorial is a must."
//Trim Function
string myString= " String Manipulation " ;
string Result= Name.Trim(); //it will remove the starting and ending space of the string.
// Remove specified number of characters from string
string myString= "The String Manipulation";
string Result= MainString.Remove(1,4);
string start = "This is a ";
string end = "concatenated string";
string result= start + end;
// Inserting Strings into Strings
string first= "Please check this code.";
string second= "understand";
Console.WriteLine(first.Insert(24, second));
// Search and Replace
string sample = "The good programming.";
string result = sample.Replace("good", "excellent"));
// Copying Strings
string myString= "The ultimate programming code.";
string result = string.Copy(myString);
// Extracting Text from a String
string sample = "The quick start tutorial is a must.";
string result = sample.Substring(4); //result will be "quick start tutorial is a must."
//Trim Function
string myString= " String Manipulation " ;
string Result= Name.Trim(); //it will remove the starting and ending space of the string.
// Remove specified number of characters from string
string myString= "The String Manipulation";
string Result= MainString.Remove(1,4);
Difference between type constructor and instance constructor? What is static constructor, when it will be fired? And what is its use?
Instance constructor is executed when a new instance of type is created and the class constructor is executed after the type is loaded and before any one of the type members is accessed. (It will get executed only 1st time, when we call any static methods/fields in the same class.) Class constructors are used for static field initialization. Only one class constructor per type is permitted, and it cannot use the vararg (variable argument) calling convention.
A static constructor is used to initialize a class. It is called automatically to initialize the class before the first instance is created or any static members are referenced.
A static constructor is used to initialize a class. It is called automatically to initialize the class before the first instance is created or any static members are referenced.
What are Satellite Assemblies?
Satellite assemblies are often used to deploy language-specific resources for an application. These language-specific assemblies work in side-by-side execution because the application has a separate product ID for each language and installs satellite assemblies in a language-specific subdirectory for each language. When uninstalling, the application removes only the satellite assemblies associated with a given language and .NET Framework version.
What Is The Difference Between ViewState and SessionState
View state is a client side state management whereas Session is used to manage state at server side.
Session variable can be accessible from all pages in web application. It is scoped to current browser session only.
ViewState persist the values of controls of particular page in the client (browser) when post back operation done. When user requests another page previous page data no longer available.
SessionState persist the data of particular user in the server. This data available till user close the browser or session time completes.
Session variable can be accessible from all pages in web application. It is scoped to current browser session only.
ViewState persist the values of controls of particular page in the client (browser) when post back operation done. When user requests another page previous page data no longer available.
SessionState persist the data of particular user in the server. This data available till user close the browser or session time completes.
Saturday, February 27, 2010
What is the use of web.config? Difference between machine.config and Web.config?
ASP.NET configuration files are XML-based text files , each named web.config that can appear in any directory on an ASP.NET Web application server. Each web.config file applies configuration settings to the directory it is located in and to all virtual child directories beneath it. Settings in child directories can optionally override or modify settings specified in parent directories.Machine.config provides default configuration settings for the entire machine. ASP.NET configures IIS to prevent direct browser access to web.config files to ensure that their values cannot become public .
At run time ASP.NET uses these web.config configuration files to hierarchically compute a unique collection of settings for each incoming URL target request (these settings are calculated only once and then cached across subsequent requests; ASP.NET automatically watches for file changes and will invalidate the cache if any of the configuration files change).
At run time ASP.NET uses these web.config configuration files to hierarchically compute a unique collection of settings for each incoming URL target request (these settings are calculated only once and then cached across subsequent requests; ASP.NET automatically watches for file changes and will invalidate the cache if any of the configuration files change).
Application and Session Events
The ASP.NET page framework provides ways for you to work with events that can be raised when your application starts or stops or when an individual user's session starts or stops:
Application events are raised for all requests to an application. For example, Application_BeginRequest is raised when any Web Forms page or XML Web service in your application is requested. This event allows you to initialize resources that will be used for each request to the application. A corresponding event, Application_EndRequest, provides you with an opportunity to close or otherwise dispose of resources used for the request.
Session events are similar to application events (there is a Session_OnStart and a Session_OnEnd event), but are raised with each unique session within the application. A session begins when a user requests a page for the first time from your application and ends either when your application explicitly closes the session or when the session times out.
You can create handlers for these types of events in the Global.asax file.
Application events are raised for all requests to an application. For example, Application_BeginRequest is raised when any Web Forms page or XML Web service in your application is requested. This event allows you to initialize resources that will be used for each request to the application. A corresponding event, Application_EndRequest, provides you with an opportunity to close or otherwise dispose of resources used for the request.
Session events are similar to application events (there is a Session_OnStart and a Session_OnEnd event), but are raised with each unique session within the application. A session begins when a user requests a page for the first time from your application and ends either when your application explicitly closes the session or when the session times out.
You can create handlers for these types of events in the Global.asax file.
Subscribe to:
Posts (Atom)