Password protected html files

G

Guest

I need to create a simple asp.net application that use password protect some
html pages. The html page provider doesn't know asp.net. And the host doesn't
allow me to create user accounts.

What's the best way to store users/password except database tables? and to
store html files?
 
G

Guest

I am not sure I understand your question completely. But if you are looking
to protect access to some HTML files in your website, you can use Forms
Authentication. Whenever the users try accessing the HTML files, if the
users are not authenticated, they will be redirected to a login page.

If you are looking at having some data in a HTML file and protecting that,
it is harder. You could take a look at the Dojo toolkit (dojotoolkit.org)
which provides some strong encryption techniques using JavaScript. Any ideas?
 
G

Guest

I think I need to write a simple forms authentication app for a html page
designer. He will create html files, which are protected by forms
authentication....

For example, I create a form authentication app in securehtmls/. And the
html pages are dumped to the folder.
will it be redirected to login screen if an un-authenticated user try to
access the html files?
 
V

vMike

nick said:
I think I need to write a simple forms authentication app for a html page
designer. He will create html files, which are protected by forms
authentication....

For example, I create a form authentication app in securehtmls/. And the
html pages are dumped to the folder.
will it be redirected to login screen if an un-authenticated user try to
access the html files?

I am not sure exactly what you are trying to do, but I think the html files
will still be served even with forms authentication unless they are in
special folders like App_Data etc (ver 2.0) or you go through some trouble
to have .net handle html files. If they are in special folders though, they
won't be served, they must be called from code. You could have a page with
an extension .aspx (which you put in a secure folder) and use something
like the following :

Sub Page_Load(sender as object, e as eventargs)
DisplayHtmlFile("Path to your secure file here")
End Sub
Sub DisplayHtmlFile(strFilePath as string)
dim reader as textreader = new streamreader(strFilePath)
dim strText as string = reader.readtoend
plc1.controls.clear
plc1.controls.add(New literalcontrol(strtext))
reader.close()
End Sub

In .aspx file
<asp:placeholder id=plc1 runat=server />
 
G

Guest

Mike,

I tried this recently. We had a bunch of images and HTML files to be
protected. I also thought (and remember seeing in earlier versions) such
static resources being served directly when the virtual folder has forms
authentication.

Recently, I tried this with ASP.NET 2.0 / IIS 6.0 and voila - the page
redirected to the login page set in forms authentication even when I accessed
static resources directly.

Nick, you can try this and see if it works for you. I made the settings in
web.config and had IIS 6.0 virtual directory setup as an IIS application.

Regards
Pandu
 
V

vMike

Pandurang Nayak said:
Mike,

I tried this recently. We had a bunch of images and HTML files to be
protected. I also thought (and remember seeing in earlier versions) such
static resources being served directly when the virtual folder has forms
authentication.

Recently, I tried this with ASP.NET 2.0 / IIS 6.0 and voila - the page
redirected to the login page set in forms authentication even when I
accessed
static resources directly.

Nick, you can try this and see if it works for you. I made the settings in
web.config and had IIS 6.0 virtual directory setup as an IIS application.

Regards
Pandu
Mine servers up the pages without authentication. Your server must have been
configured to handle html through .net. Mine apparently isn't.

Mike
 

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

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top