473,394 Members | 1,110 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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

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
7 24698
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
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
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
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
>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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Jonas | last post by:
This works fine in Win XP but does not work at all in Win 98. Private WithEvents objIExplorer As InternetExplorer I have to do it like this to get it to work in Win 98 Dim objIExplorer As...
2
by: Paul THompson | last post by:
I have a piece of code something like the following: START OF CODE <html><head><title>The Wizard</title></head> <body> <h1>Welcome to Joe's Vet Clinic</h1> <div id="part1"...
162
by: Isaac Grover | last post by:
Hi everyone, Just out of curiosity I recently pointed one of my hand-typed pages at the W3 Validator, and my hand-typed code was just ripped to shreds. Then I pointed some major sites...
5
by: me | last post by:
I have a Class Library that contains a Form and several helper classes. A thread gets created that performs processing of data behind the scenes and the Form never gets displayed (it is for debug...
6
by: benb | last post by:
I have form that looks a lot like a search bar for the user to search for records matching specified criteria (e.g. first names containing "ben"). For robust results, an intermediary form displays...
14
by: Anoop | last post by:
Hi, I am new to this newsgroup and need help in the following questions. 1. I am workin' on a GUI application. Does C# provides Layout Managers the way Java does to design GUI? I know that it...
89
by: Cuthbert | last post by:
After compiling the source code with gcc v.4.1.1, I got a warning message: "/tmp/ccixzSIL.o: In function 'main';ex.c: (.text+0x9a): warning: the 'gets' function is dangerous and should not be...
14
by: webEater | last post by:
I have a problem, it's not browser specific, and I don't get a solution. I have an (X)HTML document, I show you a part of it: .... <!--<div class="pad">--> <div id="eventImages"><img src=""...
1
by: =?ISO-8859-1?Q?Lasse_V=E5gs=E6ther_Karlsen?= | last post by:
I get the above error in some of the ASP.NET web applications on a server, and I need some help figuring out how to deal with it. This is a rather long post, and I hope I have enough details that...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.