469,286 Members | 2,399 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Password protected html files

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?
Jun 17 '06 #1
5 2553
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?

--
blog: www.thinkingMS.com/pandurang
"nick" wrote:
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?

Jun 17 '06 #2
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?

"Pandurang Nayak" wrote:
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?

--
blog: www.thinkingMS.com/pandurang
"nick" wrote:
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?

Jun 17 '06 #3

"nick" <ni**@discussions.microsoft.com> wrote in message
news:2B**********************************@microsof t.com...
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?

"Pandurang Nayak" wrote:
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?

--
blog: www.thinkingMS.com/pandurang
"nick" wrote:
> 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?


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 />
Jun 17 '06 #4
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

--
blog: www.thinkingMS.com/pandurang
"vMike" wrote:

"nick" <ni**@discussions.microsoft.com> wrote in message
news:2B**********************************@microsof t.com...
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?

"Pandurang Nayak" wrote:
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?

--
blog: www.thinkingMS.com/pandurang
"nick" wrote:

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


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 />

Jun 18 '06 #5

"Pandurang Nayak" <pandurangATthinkingmsDOT(nospam)com> wrote in message
news:EE**********************************@microsof t.com...
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

--
blog: www.thinkingMS.com/pandurang
"vMike" wrote:

"nick" <ni**@discussions.microsoft.com> wrote in message
news:2B**********************************@microsof t.com...
>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?
>
> "Pandurang Nayak" wrote:
>

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

Mike
Jun 18 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Wm | last post: by
4 posts views Thread by connoisseur.infotech | last post: by
4 posts views Thread by prophet | last post: by
3 posts views Thread by Noel S Pamfree | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.