freelanceprogrammers.org Forum Index » ASP
System.NullReferenceException error
Joined: 09 Jan 2006
Posts: 17
System.NullReferenceException error
Hello Friend
In Page_Load i have written
if (Session["Admin"].ToString()=="")
{
Response.Redirect("controlpanel.aspx?Msg=illegal");
}
when Session["Admin"] expired its not getting redirected to the specified url ,
i am getting the following error..why ? How should i write ?
Object reference not set to an instance of an object.
Description: 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.
Exception Details: System.NullReferenceException: Object reference not set to an
instance of an object.
Thanks
Arindam
Thanks & Regards
Arindam
Web Designer & Developer
Yahoo! India Matrimony: Find your life partneronline.
[Non-text portions of this message have been removed]
Joined: 11 Jan 2005
Posts: 2
System.NullReferenceException error
check for if (Session["Admin"] ==null) instead of trying to perform a ToString()
on a null reference.
Arindam <e_arindam@...> wrote:Hello Friend
In Page_Load i have written
if (Session["Admin"].ToString()=="")
{
Response.Redirect("controlpanel.aspx?Msg=illegal");
}
when Session["Admin"] expired its not getting redirected to the specified url ,
i am getting the following error..why ? How should i write ?
Object reference not set to an instance of an object.
Description: 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.
Exception Details: System.NullReferenceException: Object reference not set to an
instance of an object.
Thanks
Arindam
Thanks & Regards
Arindam
Web Designer & Developer
Yahoo! India Matrimony: Find your life partneronline.
[Non-text portions of this message have been removed]
---------------------------------
Yahoo! Groups Links
To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
To unsubscribe from this group, send an email to:
AspNetAnyQuestionIsOk-unsubscribe@yahoogroups.com
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
We don`t know a millionth of one percent about anything -- Edison
Hemant
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
[Non-text portions of this message have been removed]
Joined: 07 Jan 2006
Posts: 63
System.NullReferenceException error
.GetType.ToString() is your friend for comparison too when chekcing
out objects that may shift type if null or empty
On Mon, 10 Jan 2005 18:41:21 -0800 (PST), Hemant Anugonda
<hemantanugonda@...> wrote:
> check for if (Session["Admin"] ==null) instead of trying to perform a
> ToString() on a null reference.
>
> Arindam <e_arindam@...> wrote:Hello Friend
>
> In Page_Load i have written
> if (Session["Admin"].ToString()=="")
> {
> Response.Redirect("controlpanel.aspx?Msg=illegal");
> }
> when Session["Admin"] expired its not getting redirected to the specified
> url ,
> i am getting the following error..why ? How should i write ?
>
> Object reference not set to an instance of an object.
> Description: 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.
> Exception Details: System.NullReferenceException: Object reference not set
> to an instance of an object.
>
>
> Thanks
> Arindam
>
>
>
> Thanks & Regards
>
> Arindam
> Web Designer & Developer
>
>
>
>
> Yahoo! India Matrimony: Find your life partneronline.
>
> [Non-text portions of this message have been removed]
>
>
>
> ---------------------------------
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
>
> To unsubscribe from this group, send an email to:
> AspNetAnyQuestionIsOk-unsubscribe@yahoogroups.com
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>
>
>
>
> We don`t know a millionth of one percent about anything -- Edison
>
> Hemant
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> [Non-text portions of this message have been removed]
>
>
>
> ________________________________
> Yahoo! Groups Links
>
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
>
> To unsubscribe from this group, send an email to:
> AspNetAnyQuestionIsOk-unsubscribe@yahoogroups.com
>
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help







