I've seen many people have written code like this:
response.redire ct();
return;
or
server.transfer ();
return;
I doubt whether the statement "return;" will be hit? I think it's
redundant, isn't it? 7 1251
"lander" <lo************ @gmail.comwrote in message
news:8c******** *************** ***********@s8g 2000prg.googleg roups.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******** *************** ***********@s8g 2000prg.googleg roups.com...
I've seen many people have written code like this:
response.redire ct();
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******** ********@TK2MSF TNGP03.phx.gbl. ..
"lander" <lo************ @gmail.comwrote in message
news:8c******** *************** ***********@s8g 2000prg.googleg roups.com...
>I've seen many people have written code like this:
response.redir ect(); return;
or
server.transfe r(); 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(objec t sender, EventArgs e)
{
if (this == that)
{
Response.Redire ct("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.Redire ct("mynewpage.a spx")
return;
"return" is unnecessary
George.
"Mark Rae [MVP]" <ma**@markNOSPA Mrae.netwrote in message
news:uv******** ******@TK2MSFTN GP06.phx.gbl...
"George Ter-Saakov" <gt****@cardone .comwrote in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
>"lander" <lo************ @gmail.comwrote in message news:8c******* *************** ************@s8 g2000prg.google groups.com...
>>I've seen many people have written code like this:
response.redi rect(); return;
or
server.transf er(); 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(objec t sender, EventArgs e)
{
if (this == that)
{
Response.Redire ct("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******** ********@TK2MSF TNGP04.phx.gbl. ..
>>You are right. return will never bit hit in this case.
That's incorrect...
protected void Page_Load(objec t sender, EventArgs e) { if (this == that) { Response.Redire ct("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.Threadin g.ThreadAbortEx ception...
--
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******** ********@TK2MSF TNGP04.phx.gbl. ..
>You are right. return will never bit hit in this case.
That's incorrect...
protected void Page_Load(objec t sender, EventArgs e)
{
if (this == that)
{
Response.Redire ct("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.Threadin g.ThreadAbortEx ception...
--
Mark Rae
ASP.NET MVP http://www.markrae.net
On 3ÔÂ10ÈÕ, ÏÂÎç11ʱ19·Ö, "Mark Rae [MVP]" <m...@markNOSPA Mrae.netwrote:
"George Ter-Saakov" <gt-...@cardone.com wrote in message
news:uN******** ********@TK2MSF TNGP04.phx.gbl. ..
>You are right. return will never bit hit in this case.
That's incorrect...
protected void Page_Load(objec t sender, EventArgs e)
{
if (this == that)
{
Response.Redire ct("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.Threadin g.ThreadAbortEx ception...
--
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 datagrid. I am using the
viewstate object to store the Arraylist items on the page on postback.
My PROBLEM is that I need to redirect the user to a new aspx page and on
this new page i need to be able to access the items in my arraylist. Is this...
|
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 ="\\209.11.22.33\MyDir"
3. Typing "\\209.11.22.33\MyDir" into my ie6 browser.
4. Typing "\\209.11.22.33\MyDir" into my Windows Explorer.
5. Server-side ASP: server.transfer "\\209.11.22.33\MyDir"
6. Server-side ASP: response.redirect...
|
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 Response.Redirect("URL") or a Server.Transfer("URL").
So I'd like to find out which is more efficient/better.
Can anyone please tell me or give any pointers to links on the web?
Thanks & Regards
|
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 Silver
|
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 a session
variable, and if it is not present, does a Response.Redirect to a
webpage for the CAS passing a url parameter for the url to post back
to. The CAS provides a page for the user to log into, validates the
username and password, and then...
|
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 information will be lost.
I've tried doing a Reponse.Redirect call back to my login page whenever I
detected the Session is null, but I kept getting the exception saying "...
Redirect not all in Page Callback".
|
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 fields(firstimportname )to next page.please suggest me .please send the replay as early as possible thank u.
|
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 flow is
1. Welcome page
2. Login Page (where the SSO actually occurs)
3. Welcome page
4. Default page
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |