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 1395
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: 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: 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: 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: 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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
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.
| |