Tuesday, December 8, 2009

Log Out Funcationality in ASP.Net

to implement the log out functionality in asp.net application use the following code in the body of log out button event handler

                Session.Clear();
                Session.Abandon();
                Response.Clear();
                Response.Redirect(context.LoginPage);
and to prevent back feature of the browser or accessing the website after log out using the following line

                HttpContext.Current.Response.Cache.SetExpires(DateTime.Now);

Sunday, December 6, 2009

HttpContext in ASP.Net

The HttpContext object in the System.Web namespace encapsulates all of the information related to one request and allows you to access that information within or outside of the actual aspx page that is being processed. 


Let's Check Some Properties about the HttpContext Class: 


The static property Current on the HttpContext class can be useful whenever the flow of control leaves the code in your Page derived web form. Using this property you can reach out and magically grab the current Request, Response, Session, and Application objects (and more) for the request you are servicing





Wednesday, December 2, 2009

Difference Between XML Document & XML Fragment

XML fragments are similar to XML documents, the difference is that they are not in themselves a document. sound strange? the thought is just that an XML fragment is supposed to be part of an XML document, that is it has been taken out of the context of the document, this means that an XML fragment lacks the XML declaration () and does not have to have a root element