467,885 Members | 1,330 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,885 developers. It's quick & easy.

Form authentication and html files

I have an Asp.Net 2.0 application using form authentication. I want the html
pages be protected by the authentication system too.

The accessing of html files need to be authenticated in my local system.
However, it doesn't after I uploaded the files to my web host site.

Any setting to modify to make my hosting html files need to be authenticated
too?
Jun 22 '06 #1
  • viewed: 2850
Share:
2 Replies
> I have an Asp.Net 2.0 application using form authentication. I want the html
pages be protected by the authentication system too.


You either need to change their extension to .aspx or register .html files
as server-parsed files in IIS manager.
Jun 22 '06 #2

"nick" <ni**@discussions.microsoft.com> wrote in message
news:B2**********************************@microsof t.com...
I have an Asp.Net 2.0 application using form authentication. I want the
html
pages be protected by the authentication system too.

The accessing of html files need to be authenticated in my local system.
However, it doesn't after I uploaded the files to my web host site.

Any setting to modify to make my hosting html files need to be
authenticated
too?


You (or your host) have iis handle .html files. On the properties tag for
your website go to home directory/configuration/mappings. Add the extension
..html and the executable
yourpathto\microsoft.net\framework\v2.0.50727\aspn et_isapi.dll or to
whatever version you are using. You can just copy the .aspx executable. Then
you have to set up forms authentication in you web.config file as
follows.(Note this is the simplest form or authentication). In you
login.aspx (There are samples in the sdk) form you handle authentication.
You can take if from there to more complicated authentication.
<system.web>
<authentication mode="Forms" >
<forms loginUrl="/login.aspx"
name=".ASPNETAUTH"
protection="All"
requireSSL="false"
slidingExpiration="true"
path="/" timeout="20" >
</forms>
</authentication>
<!-- This section denies access to all files in this application except for
those that you have not explicitly specified by using another setting. -->
<authorization>
<deny users="?" />
</authorization>
</system.web>
<!-- This section gives the unauthenticated user access to
efault.aspx. -->
<location path="default.aspx">
<system.web>
<authorization>
<allow users ="*" />
</authorization>
</system.web>
</location>
<!-- This section gives the unauthenticated user access to all of the files
that are stored in the somefolder. -->
<location path="somepublicsection>
<system.web>
<authorization>
<allow users ="*" />
</authorization>
</system.web>
</location>
<!-- This section gives the unauthenticated user access to all of the files
that are stored in the aspnet_client folder for scripts. -->
<location path="aspnet_client">
<system.web>
<authorization>
<allow users ="*" />
</authorization>
</system.web>
</location>
Jun 22 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

16 posts views Thread by Philippe C. Martin | last post: by
11 posts views Thread by David W. Simmonds | last post: by
3 posts views Thread by JIM.H. | last post: by
6 posts views Thread by William F. Zachmann | last post: by
reply views Thread by MrMoon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.