Form authentication and html files

G

Guest

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?
 
G

Guest

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.
 
V

vMike

nick said:
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\aspnet_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>
 

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,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top