By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,696 Members | 1,422 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,696 IT Pros & Developers. It's quick & easy.

How does this code work?(Request["ReturnUrl"])

P: n/a
I have readed a example code from MSDN about FormsAuthenticationTicket
calss, but there's a line I can't understand :
'strRedirect = Request["ReturnUrl"];'
What's the mean in which square brackets?

Thank you!

A Chinese student.
Nov 30 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a
That is using the indexer for the object to index into it by name.

"vvkl" <ma******@hotmail.comwrote in message
news:OR**************@TK2MSFTNGP05.phx.gbl...
>I have readed a example code from MSDN about FormsAuthenticationTicket
calss, but there's a line I can't understand :
'strRedirect = Request["ReturnUrl"];'
What's the mean in which square brackets?

Thank you!

A Chinese student.

Nov 30 '06 #2

P: n/a
I can't understant well.
Could you give an example?
I want to know when is the Request["ReturnUrl"]'s value not null?

"Marina Levit [MVP]" <so*****@nospam.com写入消息新闻:%2**************** @TK2MSFTNGP05.phx.gbl...
That is using the indexer for the object to index into it by name.

"vvkl" <ma******@hotmail.comwrote in message
news:OR**************@TK2MSFTNGP05.phx.gbl...
>>I have readed a example code from MSDN about FormsAuthenticationTicket
calss, but there's a line I can't understand :
'strRedirect = Request["ReturnUrl"];'
What's the mean in which square brackets?

Thank you!

A Chinese student.


Nov 30 '06 #3

P: n/a
That is a feature of authentication. When you try and access a page
without logging in, asp.net will redirect you to the login page. The
value in the "ReturnURL" value of the query string will be the page
you original requested

On Fri, 1 Dec 2006 00:23:48 +0800, "vvkl" <ma******@hotmail.com>
wrote:
>I have readed a example code from MSDN about FormsAuthenticationTicket
calss, but there's a line I can't understand :
'strRedirect = Request["ReturnUrl"];'
What's the mean in which square brackets?

Thank you!

A Chinese student.
--

Bits.Bytes.
http://bytes.thinkersroom.com
Nov 30 '06 #4

P: n/a
Well, I'm codding a login function.
I've tried and accessed page "CustomerDetail.aspx" without logging in, then
redirected to page "login.aspx" .But, after authenticated, my code dosen't
work.

string strRedirect = Request["ReturnUrl"];
if(strRedirect == null)
strRedirect = "MyDetail.aspx";
Response.Redirect(strRedirect, true);

the value of "strRedirect" always is null.
How can "Request["ReturnUrl"]" get value?

"Rad [Visual C# MVP]" <no****@nospam.com>
??????:sq********************************@4ax.com. ..
That is a feature of authentication. When you try and access a page
without logging in, asp.net will redirect you to the login page. The
value in the "ReturnURL" value of the query string will be the page
you original requested

On Fri, 1 Dec 2006 00:23:48 +0800, "vvkl" <ma******@hotmail.com>
wrote:
>>I have readed a example code from MSDN about FormsAuthenticationTicket
calss, but there's a line I can't understand :
'strRedirect = Request["ReturnUrl"];'
What's the mean in which square brackets?

Thank you!

A Chinese student.
--

Bits.Bytes.
http://bytes.thinkersroom.com

Dec 1 '06 #5

P: n/a
>I've tried and accessed page "CustomerDetail.aspx" without logging in, then
>redirected to page "login.aspx" .But, after authenticated, my code dosen't
work.
string strRedirect = Request["ReturnUrl"];
if(strRedirect == null)
strRedirect = "MyDetail.aspx";
Response.Redirect(strRedirect, true);

the value of "strRedirect" always is null.
How can "Request["ReturnUrl"]" get value?
You need to put that onto the URL when you call up your page - e.g. if
your client tries to access "CustomerDetail.aspx" and gets redirected
to the login.aspx page, you'll need to do something like:

login.aspx?ReturnUrl=CustomerDetail.aspx

That way, you'll get the "ReturnUrl" in your Request[..] object.

Marc
Dec 1 '06 #6

P: n/a
You do me a big favor!
Thank you!

"Marc Scheuner" <no*****@for.me>
??????:0i********************************@4ax.com. ..
I've tried and accessed page "CustomerDetail.aspx" without logging in,
then
redirected to page "login.aspx" .But, after authenticated, my code dosen't
work.
string strRedirect = Request["ReturnUrl"];
if(strRedirect == null)
strRedirect = "MyDetail.aspx";
Response.Redirect(strRedirect, true);

the value of "strRedirect" always is null.
How can "Request["ReturnUrl"]" get value?

You need to put that onto the URL when you call up your page - e.g. if
your client tries to access "CustomerDetail.aspx" and gets redirected
to the login.aspx page, you'll need to do something like:

login.aspx?ReturnUrl=CustomerDetail.aspx

That way, you'll get the "ReturnUrl" in your Request[..] object.

Marc

Dec 2 '06 #7

P: n/a
You need to setup your authentication properly. In particular change
the web config such that it denies anonymous logons.

That way ASP.NET will automatically populate the ReturnURL parameter
if you access a page without logging on.

On Fri, 1 Dec 2006 13:12:05 +0800, "vvkl" <ma******@hotmail.com>
wrote:
>Well, I'm codding a login function.
I've tried and accessed page "CustomerDetail.aspx" without logging in, then
redirected to page "login.aspx" .But, after authenticated, my code dosen't
work.

string strRedirect = Request["ReturnUrl"];
if(strRedirect == null)
strRedirect = "MyDetail.aspx";
Response.Redirect(strRedirect, true);

the value of "strRedirect" always is null.
How can "Request["ReturnUrl"]" get value?

"Rad [Visual C# MVP]" <no****@nospam.com>
??????:sq********************************@4ax.com ...
>That is a feature of authentication. When you try and access a page
without logging in, asp.net will redirect you to the login page. The
value in the "ReturnURL" value of the query string will be the page
you original requested

On Fri, 1 Dec 2006 00:23:48 +0800, "vvkl" <ma******@hotmail.com>
wrote:
>>>I have readed a example code from MSDN about FormsAuthenticationTicket
calss, but there's a line I can't understand :
'strRedirect = Request["ReturnUrl"];'
What's the mean in which square brackets?

Thank you!

A Chinese student.
--

Bits.Bytes.
http://bytes.thinkersroom.com
--

Bits.Bytes.
http://bytes.thinkersroom.com
Dec 2 '06 #8

This discussion thread is closed

Replies have been disabled for this discussion.