Response.Redirect Error

H

hoz

Hi , i am developing an asp.net application (c#). I have problem :
addfovarites.aspx is protected by web.config <deny users="?" /> and my
application name is FFF . let s say when user clicks a button on some.aspx
and url is
addfovarites.aspx?myfavo=324 . If user is not authenticated , it will be
redirected to login.aspx . Everything is fine up to here . But when I try
if ( Request["ReturnUrl"]!=null)
Response.Redirect(Request.QueryString["ReturnUrl"].ToString());

else Response.Redirect("home.aspx");

i t gives you



http://localhost/addfovarites.aspx?myfavo=324 here is where I come from ,
after login I get an error like below

Object reference not set to an instance of an object.

I cant understand
 
J

Jiri Zidek

Note:
in "if" condition you use: Response["ReurnUrl"]
in your redirect call you use: Response.QueryString["ReurnUrl"]

Not quite the same !?

Pazu
 
H

hoz

if ( Request["ReturnUrl"]!=null)

Response.Redirect(Request.QueryString["ReturnUrl"].ToString());

else

Response.Redirect("myhome.aspx");

When i pass a returnurl with ?my=XXX it gives

Input string was not in a correct format.



Jiri Zidek said:
Note:
in "if" condition you use: Response["ReurnUrl"]
in your redirect call you use: Response.QueryString["ReurnUrl"]

Not quite the same !?

Pazu

hoz said:
Hi , i am developing an asp.net application (c#). I have problem :
addfovarites.aspx is protected by web.config <deny users="?" /> and my
application name is FFF . let s say when user clicks a button on
some.aspx
and url is
addfovarites.aspx?myfavo=324 . If user is not authenticated , it will be
redirected to login.aspx . Everything is fine up to here . But when I try
if ( Request["ReturnUrl"]!=null)
Response.Redirect(Request.QueryString["ReturnUrl"].ToString());

else Response.Redirect("home.aspx");

i t gives you



http://localhost/addfovarites.aspx?myfavo=324 here is where I come from ,
after login I get an error like below

Object reference not set to an instance of an object.

I cant understand
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top