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.Request.QueryString["track"].Substring(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?
The error is probably occuring because the Request.QueryString doesn't contain a "track" entry.
You should check for this before assigning it to a variable in the dll.
If you can't change the DLL - then check for it before the call to the DLL e.g
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["track"] != null) { CheckProgramAccess CPA = new CheckProgramAccess(); if (!CPA.Authorized()) { Response.Redirect("/asp/home.asp"); } else { } } }
looks you Request.QueryString["track"] is null...
When you are accessing you page ...are you passing queryString parameter track and program in the url....
What is the url of the Page?
0
MuaadeebAuthor Commented:
Thanks guys you were right. The query string was null and as a result the .DLL code had no idea what it was supposed to be referencing.
Thank you!
0
Question has a verified solution.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
You should check for this before assigning it to a variable in the dll.
If you can't change the DLL - then check for it before the call to the DLL e.g
Open in new window