Ask a Question related to ASP.NET Security, Design and Development.
-
Grant Harmeyer #1
Forms Authentication on Subdirectories of App
I would like to have a directory that is Forms authenticated so that all
ASP.NET resources contained within the directory require a logged on user.
Per spec, I have to accomplish this through the use of the <location />
element in the web.config file. I have written the code that authenticates
the user against a DB and that works fine with the login page. However, when
I attempt to type in a URL for a file in that directory (that is not the
login page) and I have NOT logged in, the page is still served. So, the
authentication is not being checked. I haven't done anything with forms
authentication before, and I have it set up nearly the same as it is set up
in the Programming ASP.NET book by Dino Esposito, except of course for the
Web.Config file. I also don't see anywhere in Dino's book that the
Authentication is checked after the initial login.
The whole thing wouldn't be much of a problem if this was it's own app with
it's own Web.Config, but per spec... not that way.
Web.Config
-----------------------------------------
<location path="main/">
<system.web>
<authentication mode="Forms">
<forms loginURL="login.aspx"
name="MaintenanceLogin"
protection="Encryption"
timeout="20"
path="/" />
</authentication>
<authorization>
<deny users="?" />
</authorization>
<compilation defaultLanguage="C#">
<assemblies>
<add assembly="GnMaintain" />
</assemblies>
</compilation>
<customErrors mode="Off" />
<globalization requestEncoding="utf-8" responseEncoding="utf-8" />
<httpRuntime executionTimeout="90" maxRequestLength="4096"
useFullyQualifiedRedirectUrl="false" minFreeThreads="8"
minLocalRequestFreeThreads="4" appRequestQueueLimit="100" />
</system.web>
</location>
Grant Harmeyer Guest
-
Accessing htm files without authentication (forms authentication)
I have application with forms authentication. All works fine. When user opens .aspx file gets login form, login and then get the .aspx page. But... -
ASP.Net Forms authentication with basic authentication popup
Relatively new to ASP.Net but have a strange problem. My site uses forms authentication for a large administration section however after the user... -
Forms authentication then redirection to a secure web with NT authentication?
Hi, I want to allow access to particular secured intranet web sites. These intranet are stored in sharepoint (2003 version) Actually I've... -
Authentication ticket, cookieless, forms authentication?
Hi. I want to use Forms Authentication, cookieless. The issue is setting the Authentication Ticket without using cookies (!) That is, the... -
Forms authentication with Windows authentication
Hi, I have an ASP.NET web site that uses IIS Basic Authentication and accesses an OLAP Server at various stages. The OLAP Server authentication... -
Hernan de Lahitte #2
Re: Forms Authentication on Subdirectories of App
I think the location path should be just path="main".
You can find a more extensive explanation of this topic here:
[url]http://www.theserverside.net/articles/printfriendly.aspx?l=FormAuthentication[/url]
Hernan L.
"Grant Harmeyer" <gn_harmeyer@hotmail.com> wrote in message
news:OKHCJ%23C8DHA.2676@TK2MSFTNGP10.phx.gbl...when> I would like to have a directory that is Forms authenticated so that all
> ASP.NET resources contained within the directory require a logged on user.
> Per spec, I have to accomplish this through the use of the <location />
> element in the web.config file. I have written the code that authenticates
> the user against a DB and that works fine with the login page. However,up> I attempt to type in a URL for a file in that directory (that is not the
> login page) and I have NOT logged in, the page is still served. So, the
> authentication is not being checked. I haven't done anything with forms
> authentication before, and I have it set up nearly the same as it is setwith> in the Programming ASP.NET book by Dino Esposito, except of course for the
> Web.Config file. I also don't see anywhere in Dino's book that the
> Authentication is checked after the initial login.
>
> The whole thing wouldn't be much of a problem if this was it's own app> it's own Web.Config, but per spec... not that way.
>
> Web.Config
> -----------------------------------------
> <location path="main/">
> <system.web>
> <authentication mode="Forms">
> <forms loginURL="login.aspx"
> name="MaintenanceLogin"
> protection="Encryption"
> timeout="20"
> path="/" />
> </authentication>
> <authorization>
> <deny users="?" />
> </authorization>
> <compilation defaultLanguage="C#">
> <assemblies>
> <add assembly="GnMaintain" />
> </assemblies>
> </compilation>
> <customErrors mode="Off" />
> <globalization requestEncoding="utf-8" responseEncoding="utf-8" />
> <httpRuntime executionTimeout="90" maxRequestLength="4096"
> useFullyQualifiedRedirectUrl="false" minFreeThreads="8"
> minLocalRequestFreeThreads="4" appRequestQueueLimit="100" />
> </system.web>
> </location>
>
>
Hernan de Lahitte Guest



Reply With Quote

