With the help of the following tutorial, you can create a user control for the footer of your web application. The article demonstrates how you can create a user control and how can you use that. In this article code is written using Visual Studio 2008. So first you need to add a web user control in your project, just follow these instructions: Continue reading
Every asp.net page has the session state by default, this may decrease the total performance a little bit. So You can disable the session state from the pages when you don’t need to use sessions. And you can do so to set the false value of the EnableSessionState attribute in the page directive of your page like as: Continue reading
There are two important session events related to session state in asp.net, one is Session_OnStart and another is Sesson_OnEnd. You can use both events in the Global.asax file in your asp.net application or websites. The Session_Start event is raised when first time session starts and Sesosion_End event raises whenever session end. Global.ascx file must be located in the root directory of the application. So you just need to create two subroutine in the Global.ascx file as:
- Public Sub Session_OnStart()
- End Sub
- Public Sub Session_OnEnd()
- End Sub
We can understand these event by taking a simple example to show the Number of the active users of the website. In this example we will create a counter by adding 1 in the application state variable ‘NoOfOnlineUsers’ on the session start and subtracting 1 from this variable on the session end
- public void Application_OnStart()
- Application["NoOfOnlineUsers"] = 0;
- public void Session_OnStart()
- Application["NoOfOnlineUsers"] = (int)Application["NoOfOnlineUsers"] + 1;
- public void Session_OnEnd()
- Application["NoOfOnlineUsers"] = (int)Application["NoOfOnlineUsers"] - 1;
From the above example you can understand the basics of the both events if you want to do more then you could do so by using these events. You can also use these events to track some more session-related information.
One more things as MSDN says ‘If the Global.asax file or Web.config file for an ASP.NET application is modified, the application will be restarted.‘ this means your Application["NoOfOnlineUsers"] value will be zero if you modified these files.
If some person does not do any action on the a page or page remains idle for some specified time then web server assumes that user left the page and then Session_OneEnd event will be raised.
Let’s say you need to create web form with dynamic number of input fields. In this article i will show you how to create input controls at run time. Continue reading
ASP.net framework provides the most feature data control in the form of DataGrid. You can display the records from the database table. You can also implement some additional functionalities such as sorting, paging, editing records etc. Continue reading
Below is the life cycle events that call during the content page with master page communicate with IIS.
Reflection provides objects (of type Type) that encapsulate assemblies, modules and types. You can use reflection to dynamically create an instance of a type, bind the type to an existing object, or get the type from an existing object and invoke its methods or access its fields and properties. If you are using attributes in your code, Reflection enables you to access them.
The Visual Basic compiler performs a process called binding when an object is assigned to an object variable. An object is early bound when it is assigned to a variable declared to be of a specific object type. Continue reading
The following code snippet demonstrate how we can use web method to fill the dataset in asp.net. Continue reading