Forms authentication for certain pages

G

Guest

Hi,

Is there any way I can cause a login page to appear, using Forms
authentication of course, when access a particular page only. In my case, I
am building a site for rental properties. There are a group of files ( HTML,
ASPX files ) that are freely publicly accessable. There are certain pages
however that my client will use to update their listings and images. I would
like those pages ONLY to be redirected to the login page but NOT the publicly
accessible files. Is there a way to target URL redirection using forms
authentication for certain files that you specify.

Thanks,

Max
 
N

news-server.maine.rr.com

Max Turavani said:
Hi,

Is there any way I can cause a login page to appear, using Forms
authentication of course, when access a particular page only. In my case,
I
am building a site for rental properties. There are a group of files (
HTML,
ASPX files ) that are freely publicly accessable. There are certain pages
however that my client will use to update their listings and images. I
would
like those pages ONLY to be redirected to the login page but NOT the
publicly
accessible files. Is there a way to target URL redirection using forms
authentication for certain files that you specify.

Thanks,

Max

Hi Max,

Just put all the files you want to protect under their own directory, and in
that directory add another web.config file specifying allow and deny.
 
G

Guest

Hi Max,

In addition to that, you can use location element:

<system.web>

<authentication mode="Forms">
<forms loginUrl="login.aspx" name="AuthCookie" path="/" timeout="20"/>
</authentication>

<!-- allow everyone too see all pages -->
<authorization>
<allow users="*"/>
</authorization>

</system.web>

<!-- restrict access to few confidential pages -->
<location path="confidentialUpdatePage1.aspx">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>

<location path="confidentialUpdatePage2.aspx">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
 
G

Guest

Thanks everyone for your responses !!!
I used the location tag option and it worked like a charm !!!!

Thanks again !!!
 

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,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top