They exist for the life of the current page.
ViewState is stored in a hidden field on the page at client side.  ViewState is transported to the client and back to the server, and is not stored on the server or any other external source.

The appSettings block in web config file sets the user-defined values for the whole application.
For example, in the following code snippet, the specified ConnectionString section is used throughout the project for database connection:

<configuration>
<appSettings>
<add key=”ConnectionString” value=”server=local; pwd=password; database=default” />
</appSettings>
</configuration>


A breakpoint is a marker in your source code that triggers automatic entry into break mode.
These features are available only in debug builds. If you compile a release build, all breakpoints are ignored. There are several ways to add breakpoints. To add simple breakpoints that break when a line is reached, just left-click on the far left of the line of code, right-click on the line, and select Breakpoint ? Insert Breakpoint; select Debug ? Toggle Breakpoint from the menu; or press F9.
A breakpoint appears as a red circle next to the line of code

Error is just an event, it occur when something wrong happened. When error event occurs, CLR creates an object of type Exception (located in System namespace. 

Note:Error is an event and exception is .Net object. 

Master pages provide functionality that developers have traditionally created by copying existing code, text, and control elements repeatedly; using framesets; using include files for common elements; using ASP.NET user controls; and so on. Advantages of master pages include the following:

  • They allow you to centralize the common functionality of your pages so that you can make updates in just one place.
  • They make it easy to create one set of controls and code and apply the results to a set of pages. For example, you can use controls on the master page to create a menu that applies to all pages.
  • They give you fine-grained control over the layout of the final page by allowing you to control how the placeholder controls are rendered.
  • They provide an object model that allows you to customize the master page from individual content pages.

Two options for tracking session IDs-

  • By default, ASP.NET uses cookie-based session tracking to keep track of user sessions. However, if a browser doesn?t support cookies, this does not work.
  • With cookieless session tracking, the session ID is encoded as part of the URL. As a result, cookieless session state works whether or not the browser supports cookies.

A method that creates a new cookie and adds it to the HttpResponse object

private void AddCookie()
{
HttpCookie nameCookie = new HttpCookie("UserName",txtUserName.Text)
nameCookie.Expires = DateTime.Now.AddYears(1);
Response.Cookies.Add(nameCookie);
}

A method that retrieves the value of a cookie from the HttpRequest object
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (!(Request.Cookies["UserName"] == null))
lblUserName.Text = "Welcome back " + Request.Cookies["UserName"].value;
}
}

A method that deletes a persistent cookie

private void DeleteCookie()
{
HttpCookie nameCookie = new HttpCookie("UserName");
nameCookie.Expires = DateTime.Now.AddSeconds(-1);
Response.Cookies.Add(nameCookie);
}

PreviousDisplaying 5 of 7Next
1 2 3 4 5 6 7
Need Help? Contact Us.

Log in

*
*

Forgot password?

*

New User

*
*
*
*