Help in forms authentication

J

JessyEzzy

I am using forms authentication against a database

<authentication mode="Forms">
<forms name="MyFormsAuthentication" loginUrl="login.aspx" path="/"
protection="All" timeout="20" />
</authentication>
<authorization>
<deny users="?" />
</authorization>

I have a requirment for a type of login where the account info, will be hard
coded and don't come from the database, and that specific account will have
access to only one page and won't be able to access any other page, how can I
implement that?

Thanks in advance.
 
D

Dominick Baier [DevelopMentor]

Hello JessyEzzy,

you could use the <credential> element (a child of <forms>)

in this element you can put usernames and passwords (you should use hashed
passwords)

also look at FormsAuthentication.HashPasswordForStoringInConfigFile and FormsAuthentication.Authenticate
 
J

JessyEzzy

Ok, but how will I specify that the user with the specific credentials will
only have access to one page of the web site.
===========================================
 
D

Dominick Baier [DevelopMentor]

Hello JessyEzzy,

do something like this:

<location path="SecuredPage.aspx">
<system.web>
<authorization>
<allow user="Alice" />
<deny users="*" />
</authorization>
</system.web>
</location>

Alice is not included in the ACLs for the rest your app..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top