473,408 Members | 2,832 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,408 software developers and data experts.

loginUrl In Web.config?

I have created a simple ASP.NET calculator in a ASPX page (which exists
in C:\Inetpub\wwwroot\ASPX folder). Before allowing a user to access
this calculator, I want to first find out whether the user is valid or
not. For the sake of brevity, assume that only the user whose UserID is
"simon" (without the quotes) & whose password is "nomis" (again,
without the quotes) will be allowed to access the calculator. So if a
user directly types the URL

http://myserver/ASPX/Calculator.aspx

in the IE address bar, the app will first check whether an
authentication cookie exists or not. I want to do this checking using
the web.config file which looks like this (note that web.config also
exists in the C:\Inetpub\wwwroot\ASPX folder):

<configuration>
<system.web>
<authentication mode="Forms">
<forms name="AuthenticateUser"
loginUrl="ValidateUser.aspx">
<credentials passwordFormat="Clear">
<user name="simon" password="nomis"/>
</credentials>
</forms>
</authentication>
</system.web>
</configuration>

This is the code in Calculator.aspx (which uses a user control & a
code-behind form; neither of them have been reproduced here):

<%@ Register TagPrefix="CBUC" TagName="Calculator"
Src="Calculator.ascx" %>
<script runat="server">
Sub Page_Load(obj As Object, ea As EventArgs)
If Not (IsNothing(Request.Cookies("AuthenticateUser"))) Then
calci.Visible = True
Else
calci.Visible = False
End If
End Sub
</script>
<form runat="server">
<CBUC:Calculator ID="calci" runat="server"/>
</form>

When a user comes to Calculator.aspx for the very first time (by typing
the URL in the address bar), it's pretty obvious that the cookie named
"AuthenticateUser" doesn't exist. So under such circumstances,
shouldn't the user be directed to the "ValidateUser.aspx" page which is
set as the "loginUrl" attribute in the "forms" tag under the
"authentication" element in the web.config file?

Thanks,

Arpan

Sep 14 '06 #1
1 3415
Hi Arpan,

I think you have to add a <deny users="?" /to the <authorizationtree
of your web.config to make sure unauthorized users are not allowed to
see other pages than your login page. You shouldn't have to worry about
the rest, ASP.NET takes care of directing users to the login page and
back to the calculator after successful authentication.

Hope this helps,

Regards,

Roland

Arpan schrieb:
When a user comes to Calculator.aspx for the very first time (by typing
the URL in the address bar), it's pretty obvious that the cookie named
"AuthenticateUser" doesn't exist. So under such circumstances,
shouldn't the user be directed to the "ValidateUser.aspx" page which is
set as the "loginUrl" attribute in the "forms" tag under the
"authentication" element in the web.config file?
Sep 14 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Hermit Dave | last post by:
Hi, I am making a web application (rather two applications) one which is host and used by customers when they are just browsing through products. The second application resides on a secure...
0
by: Hermit Dave | last post by:
Steven, Just a quick query.... in the two apps i have... it works fine on my local machine... but was talking to someone who was implementing a very similar method.... and it was then that i...
2
by: Murphy | last post by:
Our website contains subdirectories for each subsidiary company, each company has it's own look and feel to the pages in their subdirectory although they are all part of the main website. The...
6
by: TJS | last post by:
i'm having problems where the user is not correctly redirected to login page if starting in a folder below the webroot. in these cases, it always tries to go to /foldername/login.aspx this is...
3
by: dgator | last post by:
Is it possible to have multiple LoginURL's. I have a situation where I have a certain url redirect into my secure web application. I have the specific login credentials handled fine. The users...
0
by: gabe | last post by:
Is there a way to read the loginURL attribute of the forms element in the web.config file? We have a standard Login.aspx page we use for custom authentication. When the site is down for...
2
by: ad | last post by:
I have define a LoginUrl in Web.config like: <authentication mode="Forms"> <forms name="HealthCookie" loginUrl="Login.aspx" protection="Validation" timeout="99999"> How can I refer the LoginUrl...
3
by: cashdeskmac | last post by:
I have read that when using Forms Authentication, if you do not specify a value for the LoginUrl attribute it defaults to default.aspx. However, to test this, I create an application, add a new...
1
by: ad | last post by:
I have defined the LoginUrl and defaultUrl in web.config. <authentication mode="Forms"> <forms name="HealthCookie" loginUrl="Login.aspx" defaultUrl="Home.aspx" protection="Validation"> </forms>...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
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
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
agi2029
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,...
0
isladogs
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...

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.