I've seen many people have written code like this:
response.redirect();
return;
or
server.transfer();
return;
I doubt whether the statement "return;" will be hit? I think it's
redundant, isn't it? 7 1236
"lander" <lo************@gmail.comwrote in message
news:8c**********************************@s8g2000p rg.googlegroups.com...
I doubt whether the statement "return;" will be hit? I think it's
redundant, isn't it?
No.
--
Mark Rae
ASP.NET MVP http://www.markrae.net
You right.
return will never bit hit in this case.
But I still always put it for clarity
George.
"lander" <lo************@gmail.comwrote in message
news:8c**********************************@s8g2000p rg.googlegroups.com...
I've seen many people have written code like this:
response.redirect();
return;
or
server.transfer();
return;
I doubt whether the statement "return;" will be hit? I think it's
redundant, isn't it?
"George Ter-Saakov" <gt****@cardone.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
"lander" <lo************@gmail.comwrote in message
news:8c**********************************@s8g2000p rg.googlegroups.com...
>I've seen many people have written code like this:
response.redirect(); return;
or
server.transfer(); return;
I doubt whether the statement "return;" will be hit? I think it's redundant, isn't it?
You are right.
return will never bit hit in this case.
That's incorrect...
protected void Page_Load(object sender, EventArgs e)
{
if (this == that)
{
Response.Redirect("mypage.aspx", false);
//return;
}
if (this != that)
{
// this *will* run if the above return is not unremmed...
}
}
--
Mark Rae
ASP.NET MVP http://www.markrae.net
Yes, there is a second parameter which will change default behavior.
But default behavior would terminate the execution.
So in
Response.Redirect("mynewpage.aspx")
return;
"return" is unnecessary
George.
"Mark Rae [MVP]" <ma**@markNOSPAMrae.netwrote in message
news:uv**************@TK2MSFTNGP06.phx.gbl...
"George Ter-Saakov" <gt****@cardone.comwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>"lander" <lo************@gmail.comwrote in message news:8c**********************************@s8g2000 prg.googlegroups.com...
>>I've seen many people have written code like this:
response.redirect(); return;
or
server.transfer(); return;
I doubt whether the statement "return;" will be hit? I think it's redundant, isn't it?
You are right. return will never bit hit in this case.
That's incorrect...
protected void Page_Load(object sender, EventArgs e)
{
if (this == that)
{
Response.Redirect("mypage.aspx", false);
//return;
}
if (this != that)
{
// this *will* run if the above return is not unremmed...
}
}
--
Mark Rae
ASP.NET MVP http://www.markrae.net
"George Ter-Saakov" <gt****@cardone.comwrote in message
news:uN****************@TK2MSFTNGP04.phx.gbl...
>>You are right. return will never bit hit in this case.
That's incorrect...
protected void Page_Load(object sender, EventArgs e) { if (this == that) { Response.Redirect("mypage.aspx", false); //return; }
if (this != that) { // this *will* run if the above return is not unremmed... } }
Yes, there is a second parameter which will change default behavior.
But default behavior would terminate the execution.
Yes, that's true, but that would raise a
System.Threading.ThreadAbortException...
--
Mark Rae
ASP.NET MVP http://www.markrae.net
thats generally what you want.
overwise you need to override the render event, set a flag that a redirect
was done, then cancel the render (and maybe prerender). you may need to also
override the event firing logic, as you probably don't want to raise events
after a redirect.
if you don't do this, all the page processing happens, and html is
downloaded to the browser, but ignored because of the redirect header.
-- bruce (sqlwork.com)
"Mark Rae [MVP]" wrote:
"George Ter-Saakov" <gt****@cardone.comwrote in message
news:uN****************@TK2MSFTNGP04.phx.gbl...
>You are right. return will never bit hit in this case.
That's incorrect...
protected void Page_Load(object sender, EventArgs e)
{
if (this == that)
{
Response.Redirect("mypage.aspx", false);
//return;
}
if (this != that)
{
// this *will* run if the above return is not unremmed...
}
}
Yes, there is a second parameter which will change default behavior.
But default behavior would terminate the execution.
Yes, that's true, but that would raise a
System.Threading.ThreadAbortException...
--
Mark Rae
ASP.NET MVP http://www.markrae.net
On 3ÔÂ10ÈÕ, ÏÂÎç11ʱ19·Ö, "Mark Rae [MVP]" <m...@markNOSPAMrae.netwrote:
"George Ter-Saakov" <gt-...@cardone.comwrote in message
news:uN****************@TK2MSFTNGP04.phx.gbl...
>You are right. return will never bit hit in this case.
That's incorrect...
protected void Page_Load(object sender, EventArgs e)
{
if (this == that)
{
Response.Redirect("mypage.aspx", false);
//return;
}
if (this != that)
{
// this *will* run if the above return is not unremmed...
}
}
Yes, there is a second parameter which will change default behavior.
But default behavior would terminate the execution.
Yes, that's true, but that would raise a
System.Threading.ThreadAbortException...
--
Mark Rae
ASP.NET MVPhttp://www.markrae.net- Òþ²Ø±»ÒýÓÃÎÄ×Ö -
- ÏÔʾÒýÓõÄÎÄ×Ö -
Hi mark, would you pls explain *why* to us? Thanks really. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Stephen |
last post by:
I was wondering if someone can help me with an web application design
problem. I have a aspx page which builds up an arraylist called addresses
and outputs the values in the arraylist items to a...
|
by: \A_Michigan_User\ |
last post by:
Ok, I give up... why do 1-4 work fine... but 5-6 give "can't find" errors?
1. Client-side VBscript code: call navigate("\\209.11.22.33\MyDir")
2. Client-side VBscript code: location.href...
|
by: Harsh Thakur |
last post by:
Hi,
I'd like to know the performance related differences between
Response.Redirect and Server.Transfer.
I'd like to redirect the user to a different page.
I can either do a...
|
by: Alan Silver |
last post by:
Hello,
Sorry if this is a stupid question, but I can't really see much
difference between these tow methods according to the scant info in the
SDK.
Could anyone enlighten me? TIA
--
Alan...
|
by: odwrotnie |
last post by:
Hi,
what is the difference between
Response.Redirect("Stop.aspx");
and
Server.Transfer("Stop.aspx");
?
--
Best regards,
| |
by: venner |
last post by:
I'm having an issue with an ASP.NET website after upgrading to ASP.NET
2.0. The website makes use of a central authentication service (CAS)
provided at the university I work for. Each page checks...
|
by: Simon Says |
last post by:
Hi,
I've a login page in which after authenticating it via the Oracle DB, I will
stored the user information into the Session. However, when the Session
timeout occurs, all of the user...
|
by: phanimadhav |
last post by:
Response.Redirect("explain.aspx?firstimportname="+filename);
This is my statement.In this statement i am sending only single value to next page.but i want to pass multiple values by using multiple...
|
by: jasonheath.net |
last post by:
I apologize in advance for the length of this post. I wanted to get as
much detail as possible in here.
We have 1 web app that contains the functionality to do some single
sign-on logic. The...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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...
| |
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: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |