Hi,
I have a fairly simple site, the vast majority of which is available to
everyone on the public internet.
However, the site has one section which requires logon via the standard
username-password combination. The usernames and passwords are stored in
encrypted form in SQL Server 2000.
To prevent people trying to access the pages in the secure section, I used
to have the following code in ASP.NET v1.1:
private void Page_Load(objec t sender, System.EventArg s e)
{
if ((bool)Session["LoggedOn"] = = false)
{
Response.Redire ct("../login", false);
}
// rest of Page_Load code
}
This, fairly obviously, checked the value of a Session variable (created in
Session_Start) and, if it was false i.e. the user hadn't logged, then it
redirected immediately to the login page without running the rest of the
code in the Page_Load event. This worked fine in ASP.NET v1.1.
However, in v2, although the Response.Redire ct eventually runs, the rest of
the code in Page_Load runs too. I can get round this by inserting "return;"
after the Response.Redire ct line, but I'm curious to know if this is an
example of changed behaviour from ASP.NET v1.1 to ASP.NET v2.
Any assistance gratefully received.
Mark
P.S. I'm fully aware of Forms authentication. .. :-) 2 1397
Thus wrote Mark, Hi,
I have a fairly simple site, the vast majority of which is available to everyone on the public internet.
However, the site has one section which requires logon via the standard username-password combination. The usernames and passwords are stored in encrypted form in SQL Server 2000.
To prevent people trying to access the pages in the secure section, I used to have the following code in ASP.NET v1.1:
private void Page_Load(objec t sender, System.EventArg s e) { if ((bool)Session["LoggedOn"] = = false) { Response.Redire ct("../login", false); } // rest of Page_Load code } This, fairly obviously, checked the value of a Session variable (created in Session_Start) and, if it was false i.e. the user hadn't logged, then it redirected immediately to the login page without running the rest of the code in the Page_Load event. This worked fine in ASP.NET v1.1.
However, in v2, although the Response.Redire ct eventually runs, the rest of the code in Page_Load runs too. I can get round this by inserting "return;" after the Response.Redire ct line, but I'm curious to know if this is an example of changed behaviour from ASP.NET v1.1 to ASP.NET v2.
Any assistance gratefully received.
You get what you've asked for ;-)
That bool parameter specifies whether a HttpResponse.Re direct() implicitly
ends the response, and you've set it to false. Both Response.Redire ct("../login",
true) or Response.Redire ct("../login") would do the trick.
As far as history is concerned -- http://support.microsoft.com/kb/307903/en-us
implies that this behavior has been implemented since ASP.NET 1.0.
Cheers,
--
Joerg Jooss ne********@joer gjooss.de
"Joerg Jooss" <ne********@joe rgjooss.de> wrote in message
news:94******** *************** ***@msnews.micr osoft.com... You get what you've asked for ;-)
That bool parameter specifies whether a HttpResponse.Re direct() implicitly ends the response, and you've set it to false. Both Response.Redire ct("../login", true) or Response.Redire ct("../login") would do the trick.
As far as history is concerned -- http://support.microsoft.com/kb/307903/en-us implies that this behavior has been implemented since ASP.NET 1.0.
Hmm - I'm obviously getting myself confused here! I've always used the false
overload with Response.Redire ct to avoid the "Response was being terminated"
error...
Thanks for the reply. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Paul |
last post by:
I'm not getting the results I want when I use
Response.Redirct in a ASP page.
I enter this line of code in a asp page from domain1.com.
Response.Redirect "http://www.domain2.com/VDIR2/table.asp"
& "?PubID=" & PubID & "&PubName=" & PubName
The query string is data to open a DB. the page displays
|
by: JC |
last post by:
Hi,
I have a simple question regarding the Response.Redirect method. Does the
server stop processing the ASP code as soon as it encounters the Redirect
command? Or does it ever continue to process the page?
Basically, with the following code:
Response.Redirect("../newpage.asp")
|
by: TomT |
last post by:
Hi..
I'm redirecting users to another page using:
response.redirect("newpage.asp")
this works... But I need to add a variable to the page specified..
IE: newpage.asp?id=JobID
|
by: Sam |
last post by:
I have some issues with HTTP Headers and I was hoping for
some pointers or references to good articles.
Here is the problem.
I have 6 .aspx pages, each page contains a common .ascx.
This ascx serves two purposes, 1. it contains a tab strip
with response.redirects to navigate to the other pages;
2. I authenticate the user by check to see if a cookie
exists, if it doesn't I redirect to a login screen.
|
by: Sehboo |
last post by:
On my ASP page, when I click a button, I want to do three things:
1. Check for some values.
2. Open a new window and pass some values as query string.
3. Redirect to some other page
Here is the code:
If (sServiceCenter = "*ALL") Then
sServiceCenter = "%"
| |
by: Tim |
last post by:
Hello,
Is there a way to "cancel" a response.Redirect? For example, in the code
below, could I insert anything in the Catch statement that would cancel the
redirect and resume flow after the try-catch?
Try
Response.Redirect(strPage)
Catch ex1 As Threading.ThreadAbortException
ex1 = ex1
'Cancel Respone here
|
by: Niggy |
last post by:
I get an error - any help appreciated.
System.Threading.ThreadAbortException: Thread was being aborted. at
System.Threading.Thread.AbortInternal() at
System.Threading.Thread.Abort(Object stateInfo) at
System.Web.HttpResponse.End() at System.Web.HttpResponse.Redirect(String url,
Boolean endResponse) at
WebApplication1.WebForm4.DropDownList1_SelectedIndexChanged(Object sender,
EventArgs e) in...
|
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: mike.biang |
last post by:
I have an ASP page that is using an XMLHTTP object to request various
pages from my server. I keep a single session throughout the XMLHTTP
requests by bassing the ASPSESSIONID cookie through the XMLHTTP object.
However, when the page requested through the XML object makes a
<%Response.Redirect()%>
call, a new session is created each time.
Is this a flaw in the XMLHTTP Object? How can I force the session to
remain the same after a...
|
by: RN1 |
last post by:
When a server encounters the line
Response.Redirect("abcd.asp")
in a ASP script, the server tells the browser that it has to be
redirected to another page (which is abcd.asp, in this case). The
browser then makes a new request to the server to redirect itself to
abcd.asp after which the user gets redirected to abcd.asp.
But in case of Server.Execute (or Server.Transfer), when the server
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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: 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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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: 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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
| |
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
| |