hi,
i have used session in my .net project. its version is 1.1, when ever i load that page i get the following error,
my coding which caused this error is
what could be the cause of this error. i know that this error can be caught using exceptions, but my problem is i need to use nested try commands. as a result of this problem it is not entering into the nested region and throws exception. how to solve this problem.
thanks,
i have used session in my .net project. its version is 1.1, when ever i load that page i get the following error,
Code:
[b]Server Error in '/Alfi/invoice generation/WebApplication1' Application. [/b]
[b][i]Object reference not set to an instance of an object.[/i] [/b]
[font=Arial, Helvetica, Geneva, SunSans-Regular, sans-serif][b]Description: [/b]An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
[b]Exception Details: [/b]System.NullReferenceException: Object reference not set to an instance of an object.
[b]Source Error:[/b]
Line 41: // tryLine 42: // {[color=red]Line 43: if(Session["UnAuthorised"].ToString()!="")[/color]Line 44: {Line 45: lblPlzLgn.Visible=true;
[b][font=Verdana]Source File: [/font][/b]\\avsystems11\alfi\invoice generation\webapplication1\scripts\login.aspx.cs[b][font=Verdana] Line: [/font][/b]43
[b][font=Verdana]Stack Trace:[/font][/b]
[NullReferenceException: Object reference not set to an instance of an object.] AutomaticInvoiceGeneration.Login.Page_Load(Object sender, EventArgs e) in \\avsystems11\alfi\invoice generation\webapplication1\scripts\login.aspx.cs:43 System.Web.UI.Control.OnLoad(EventArgs e) +67 System.Web.UI.Control.LoadRecursive() +35 System.Web.UI.Page.ProcessRequestMain() +731
[b][font=Verdana]Version Information:[/font][/b] Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573 [/font]
Code:
[size=2][color=#0000ff]private[/color][/size][size=2] [/size][size=2][color=#0000ff]void[/color][/size][size=2] Page_Load([/size][size=2][color=#0000ff]object[/color][/size][size=2] sender, System.EventArgs e)
{
lblPlzLgn.Visible=[/size][size=2][color=#0000ff]false[/color][/size][size=2];
lblSessionExp.Visible=[/size][size=2][color=#0000ff]false[/color][/size][size=2];
Session["text"]="";
Session["Alert"]="";
[/size][size=2][/size][size=2][color=#0000ff]if[/color][/size][size=2](Session["UnAuthorised"].ToString()!="")
{
lblPlzLgn.Visible=[/size][size=2][color=#0000ff]true[/color][/size][size=2];
Session["UnAuthorised"]="";
}
[/size][size=2][color=#0000ff]else
[/color][/size][size=2]{
some conditions();
}
[/size]
thanks,
Comment