17 Jun 2009

Problems in App_Code

There are many properties don't exist in App_Code pages.

Session in App_Code
when we use Session in App_Code following by error message
The name 'Session' doesn't exist in the current context
To fix this problem write next line in C#.net 2005
System.Web.HttpContext.Current.Session["SessionName"] = value;

Response in App_Code
when we use Response.Redirect in App_Code following by error message
The name 'Response' doesn't exist in the current context
To fix this problem write next line in C#.net 2005
System.Web.HttpContext.Current.Response.Redirect("Page.aspx");

0 comments: