Muaadeeb
asked on
Object reference not set to an instance of an object. !ISPOSTBACK
Hello,
I am getting the Object Reference message but I am confused because I did create an instance of the base class in the calling program " CheckProgramAccess CPA = new CheckProgramAccess()"
The error is being thrown within the .DLL at this statement:
"string TrackId = HttpContext.Current.Reques t.QueryStr ing["track "].Substri ng(0,8) ;"
The Part 2 of the code is in a .dll which I am not allowed to change. So my question is - two fold:
1). Why is this error happening since I did create an instance as demonstrated by CPA....and
2). How do I resolve this within my Part 1 code sniplet?
Thank you!
I am getting the Object Reference message but I am confused because I did create an instance of the base class in the calling program " CheckProgramAccess CPA = new CheckProgramAccess()"
The error is being thrown within the .DLL at this statement:
"string TrackId = HttpContext.Current.Reques
The Part 2 of the code is in a .dll which I am not allowed to change. So my question is - two fold:
1). Why is this error happening since I did create an instance as demonstrated by CPA....and
2). How do I resolve this within my Part 1 code sniplet?
Thank you!
Part#1:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
CheckProgramAccess CPA = new CheckProgramAccess();
if (!CPA.Authorized())
{
Response.Redirect("/asp/home.asp");
}
else
{
}
}
=========
Part# 2:
public class CheckProgramAccess
{
public CheckProgramAccess()
{
//
// TODO: Add constructor logic here
//
}
public bool Authorized()
{
bool Authenticated = true;
bool RtnCde = false ;
string UpId = "" ;
string TimeOut = "" ;
string LogTime = "" ;
try
{
string TrackId = HttpContext.Current.Request.QueryString["track"].Substring(0,8) ;
string Program = HttpContext.Current.Request.QueryString["program"].ToString() ;
}
catch(Exception ex)
{
string msg = ex.Message.ToString();
Authenticated = false ;
}
return Authenticated;
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you!