By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,230 Members | 2,471 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,230 IT Pros & Developers. It's quick & easy.

Password protected html files

P: n/a
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
Share this Question
Share on Google+
5 Replies


P: n/a
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

P: n/a
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

P: n/a

"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

P: n/a
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

P: n/a

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