Hi guys
Ok, I have a website which has an "Artists Only" section, for which you have
to login for. This section is contained within its own directory on the
server "/aonly".
I want to make people login before they can access this directory, with a
User control on each page for logging in. I'd like to use Forms auth and sql
server (i know how to check that against the entered details).
I also want a login.aspx page so that if their session expires, it's easy to
log back in.
Question is.. how do I create the forms auth and make it protect the
"/aonly" directory, and can I make the user control authenticate the user,
and then forward to the protected directory?
HOpe that makes sense!
Cheers
Dan 4 1329
You should enable forms authentication in your root web.config (root of you
application, that is). For the subdirectory, you should then set the authorization
to not allow anonymous users. I presume the rest of the site is accessible
to anonymous users?
Here are the docs for configuring forms authentication: http://msdn.microsoft.com/library/de...gngrfforms.asp
And here's how you'd set the authorization: http://msdn.microsoft.com/library/de...asp?frame=true
Now since you're looking to control authorization on a subdirectory, the
authorization could go into an independant web.config in the child directory
you want to contol access to.
-Brock
DevelopMentor http://staff.develop.com/ballen Hi guys
Ok, I have a website which has an "Artists Only" section, for which you have to login for. This section is contained within its own directory on the server "/aonly".
I want to make people login before they can access this directory, with a User control on each page for logging in. I'd like to use Forms auth and sql server (i know how to check that against the entered details).
I also want a login.aspx page so that if their session expires, it's easy to log back in.
Question is.. how do I create the forms auth and make it protect the "/aonly" directory, and can I make the user control authenticate the user, and then forward to the protected directory?
HOpe that makes sense!
Cheers
Dan
Thanks Brock,
That seems to have got all the security stuff setup. I'm assuming I put the
code to authenticate against SQL in a function called by the clicking of my
signup button, is that right?
In which case, when I've authenticated a user, what do I need to set in
order for Forms authentication to let them in?
Cheers
Dan
"Brock Allen" wrote: You should enable forms authentication in your root web.config (root of you application, that is). For the subdirectory, you should then set the authorization to not allow anonymous users. I presume the rest of the site is accessible to anonymous users?
Here are the docs for configuring forms authentication:
http://msdn.microsoft.com/library/de...gngrfforms.asp
And here's how you'd set the authorization:
http://msdn.microsoft.com/library/de...asp?frame=true
Now since you're looking to control authorization on a subdirectory, the authorization could go into an independant web.config in the child directory you want to contol access to.
-Brock DevelopMentor http://staff.develop.com/ballen Hi guys
Ok, I have a website which has an "Artists Only" section, for which you have to login for. This section is contained within its own directory on the server "/aonly".
I want to make people login before they can access this directory, with a User control on each page for logging in. I'd like to use Forms auth and sql server (i know how to check that against the entered details).
I also want a login.aspx page so that if their session expires, it's easy to log back in.
Question is.. how do I create the forms auth and make it protect the "/aonly" directory, and can I make the user control authenticate the user, and then forward to the protected directory?
HOpe that makes sense!
Cheers
Dan
You want to do something like this
public void Login_Click(Obj ect sender, EventArgs E)
{
_UserName = UserName.Value;
_Password = UserPass.Value;
if (CheckUserAndPa ssword (_ServerName, _DatabaseName,_ UserName
,_Password))
{
System.Web.Secu rity.FormsAuthe ntication.Redir ectFromLoginPag e(UserName.Valu e,false);
}
else
{
Msg.Text = "Invalid Credentials: Please try again";
}
}
which puts them back to the originally requested URL.
Kirsty
> That seems to have got all the security stuff setup. I'm assuming I put the code to authenticate against SQL in a function called by the clicking of my signup button, is that right?
Right - you'll have to write the code to do the actual authentication against
your database of usernames/passwords.
In which case, when I've authenticated a user, what do I need to set in order for Forms authentication to let them in?
So once you know the user has provided valid credntials, you use FormsAuthentica tion.RedirectFr omLoginPage("Th eirUsername",
false) or FormsAuthentica tion.SetAuthCoo kie to tell ASP.NET that they're
logged in.
-Brock
DevelopMentor http://staff.develop.com/ballen This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: tascien |
last post by:
I an application that i want to set up for two clients.
http://localhost/client1 <- virtual directory.
http://localhost/client2 <- virtual directory.
Now, i don't want these application to read each others information.
I did not see where, In the asp.net forms auth. where i can specify the
path.
|
by: Justin |
last post by:
I am trying to password protect a subdirectory using forms authentication. I
am using the "Location" tag to specify the directory to be protected. The
login.aspx page is in the root directory of the app. Here is the web.config:
<location path="Admin">
<system.web>
<authentication mode="Forms">
<forms name="authAdmin" loginUrl="Login.aspx" protection="All" timeout="30">
<credentials passwordFormat="Clear">
<user name="Admin"...
|
by: tascien |
last post by:
I an application that i want to set up for two clients.
http://localhost/client1 <- virtual directory.
http://localhost/client2 <- virtual directory.
Now, i don't want these application to read each others information.
I did not see where, In the asp.net forms auth. where i can specify the
path.
|
by: Smokey Grindle |
last post by:
I am using forms authentication with a custom user database... I was
wondering, when logging in using forms auth, does the
HttpContext.Current.User return the forms logged in user or the AD user that
is running the web process in that situation? I am assumeing the forms
logged in user
|
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: 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: 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: 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: 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...
| |