473,404 Members | 2,178 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,404 software developers and data experts.

forms-based authentication

Vic
I am trying to implement a forms-based authentication on my website, so some
directories will have web.config file which will deny certain users, based
on role, etc. The problem I encountered is that it's only asp.net files (or
the files with the extension mapped to aspnet_isapi.dll) are the ones being
secured.

The solution I found is to map all of the extension I'd keep in my secured
directory to aspnet_isapi.dll.

I am planning to map .htm, *.exe, and *.shtm files to be processed by .NET.
How is it going to affect the performance of the site? Is there another way
of achieving the same thing?

Thanks,
Vic
Nov 17 '05 #1
9 1226
I accomplished this in a recent project by putting other files in a private
directory.
Then when I needed to send one of the files to the user, I'd use
Response.WriteFile to grab the file from the private directory and output it
to the user. Of couse the ASPNET user account needs read access to the
private directory.
I used code similar to this:
Response.Clear();
Response.AddHeader("Content-Disposition","inline;filename=myfile.doc");
Response.WriteFile("c:\privatedir\myfile.doc");

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com


"Vic" <ro****@gat.com> wrote in message
news:uB**************@TK2MSFTNGP12.phx.gbl...
I am trying to implement a forms-based authentication on my website, so some directories will have web.config file which will deny certain users, based
on role, etc. The problem I encountered is that it's only asp.net files (or the files with the extension mapped to aspnet_isapi.dll) are the ones being secured.

The solution I found is to map all of the extension I'd keep in my secured
directory to aspnet_isapi.dll.

I am planning to map .htm, *.exe, and *.shtm files to be processed by ..NET. How is it going to affect the performance of the site? Is there another way of achieving the same thing?

Thanks,
Vic

Nov 17 '05 #2
"Vic" <ro****@gat.com> wrote in message
news:uB**************@TK2MSFTNGP12.phx.gbl...
I am trying to implement a forms-based authentication on my website, so some directories will have web.config file which will deny certain users, based
on role, etc. The problem I encountered is that it's only asp.net files (or the files with the extension mapped to aspnet_isapi.dll) are the ones being secured.

The solution I found is to map all of the extension I'd keep in my secured
directory to aspnet_isapi.dll.

I am planning to map .htm, *.exe, and *.shtm files to be processed by ..NET. How is it going to affect the performance of the site? Is there another way of achieving the same thing?


The only way to find out how it performs is to try it.

As a general statement, consider that it shouldn't be any worse than the
performance of processing ASP.NET files, which have to deal with executing
code and possibly even compiling it.

One thing to be aware of: the StaticFileHandler which ASP.NET uses for these
file types seems to read the entire file into memory before sending it out.
This can be an issue for huge files...
--
John
Nov 17 '05 #3
Vic
Thanks, John.

I think it's not such a hot idea, since some of the files are more than
20MB...

I'll probably use Steve's approach:
Response.WriteFile("c:\privatedir\myfile.doc");

Of course, this could also load the file in the memory first...

Thanks,
Vic

"John Saunders" <john.saunders at surfcontrol.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
"Vic" <ro****@gat.com> wrote in message
news:uB**************@TK2MSFTNGP12.phx.gbl...
I am trying to implement a forms-based authentication on my website, so some
directories will have web.config file which will deny certain users, based on role, etc. The problem I encountered is that it's only asp.net files

(or
the files with the extension mapped to aspnet_isapi.dll) are the ones

being
secured.

The solution I found is to map all of the extension I'd keep in my secured directory to aspnet_isapi.dll.

I am planning to map .htm, *.exe, and *.shtm files to be processed by

.NET.
How is it going to affect the performance of the site? Is there another

way
of achieving the same thing?


The only way to find out how it performs is to try it.

As a general statement, consider that it shouldn't be any worse than the
performance of processing ASP.NET files, which have to deal with executing
code and possibly even compiling it.

One thing to be aware of: the StaticFileHandler which ASP.NET uses for

these file types seems to read the entire file into memory before sending it out. This can be an issue for huge files...
--
John

Nov 17 '05 #4
Vic
Thanks, Steve.

It sure does help...

Vic

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I accomplished this in a recent project by putting other files in a private directory.
Then when I needed to send one of the files to the user, I'd use
Response.WriteFile to grab the file from the private directory and output it to the user. Of couse the ASPNET user account needs read access to the
private directory.
I used code similar to this:
Response.Clear();
Response.AddHeader("Content-Disposition","inline;filename=myfile.doc");
Response.WriteFile("c:\privatedir\myfile.doc");

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com


"Vic" <ro****@gat.com> wrote in message
news:uB**************@TK2MSFTNGP12.phx.gbl...
I am trying to implement a forms-based authentication on my website, so

some
directories will have web.config file which will deny certain users, based on role, etc. The problem I encountered is that it's only asp.net files

(or
the files with the extension mapped to aspnet_isapi.dll) are the ones

being
secured.

The solution I found is to map all of the extension I'd keep in my secured directory to aspnet_isapi.dll.

I am planning to map .htm, *.exe, and *.shtm files to be processed by

.NET.
How is it going to affect the performance of the site? Is there another

way
of achieving the same thing?

Thanks,
Vic


Nov 17 '05 #5
Vic
Steve.

Is there an easy way to simulate the Save As behavior with
Response.WriteFile() ? I want user to prompted with the Save As dialog and
the file to be downloaded to the specified location on user's PC, instead of
dumping it into the page.

Thanks in advance.

Vic
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I accomplished this in a recent project by putting other files in a private directory.
Then when I needed to send one of the files to the user, I'd use
Response.WriteFile to grab the file from the private directory and output it to the user. Of couse the ASPNET user account needs read access to the
private directory.
I used code similar to this:
Response.Clear();
Response.AddHeader("Content-Disposition","inline;filename=myfile.doc");
Response.WriteFile("c:\privatedir\myfile.doc");

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com


"Vic" <ro****@gat.com> wrote in message
news:uB**************@TK2MSFTNGP12.phx.gbl...
I am trying to implement a forms-based authentication on my website, so

some
directories will have web.config file which will deny certain users, based on role, etc. The problem I encountered is that it's only asp.net files

(or
the files with the extension mapped to aspnet_isapi.dll) are the ones

being
secured.

The solution I found is to map all of the extension I'd keep in my secured directory to aspnet_isapi.dll.

I am planning to map .htm, *.exe, and *.shtm files to be processed by

.NET.
How is it going to affect the performance of the site? Is there another

way
of achieving the same thing?

Thanks,
Vic


Nov 17 '05 #6
"Vic" <ro****@gat.com> wrote in message
news:O9*************@TK2MSFTNGP11.phx.gbl...
Thanks, John.

I think it's not such a hot idea, since some of the files are more than
20MB...

I'll probably use Steve's approach:
Response.WriteFile("c:\privatedir\myfile.doc");

Of course, this could also load the file in the memory first...


Victor,

In a similar case, I wrote a asynchronous HttpHandler (implementing
IHttpAsyncHandler) to handle product downloads from our site. I found the
following article very helpful in that:

Use Threads and Build Asynchronous Handlers in Your Server-Side Web Code
(http://msdn.microsoft.com/msdnmag/is.../default.aspx).

I hope that helps,
John
Nov 17 '05 #7
change inline to attachment on the Response.Addheader line.
Like this:
Response.AddHeader("Content-Disposition","attachment;filename=myfile.doc");

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"Vic" <ro****@gat.com> wrote in message
news:ul*************@TK2MSFTNGP10.phx.gbl...
Steve.

Is there an easy way to simulate the Save As behavior with
Response.WriteFile() ? I want user to prompted with the Save As dialog and
the file to be downloaded to the specified location on user's PC, instead of dumping it into the page.

Thanks in advance.

Vic
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I accomplished this in a recent project by putting other files in a private
directory.
Then when I needed to send one of the files to the user, I'd use
Response.WriteFile to grab the file from the private directory and output it
to the user. Of couse the ASPNET user account needs read access to the
private directory.
I used code similar to this:
Response.Clear();
Response.AddHeader("Content-Disposition","inline;filename=myfile.doc");
Response.WriteFile("c:\privatedir\myfile.doc");

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com


"Vic" <ro****@gat.com> wrote in message
news:uB**************@TK2MSFTNGP12.phx.gbl...
I am trying to implement a forms-based authentication on my website,
so some
directories will have web.config file which will deny certain users, based on role, etc. The problem I encountered is that it's only asp.net
files (or
the files with the extension mapped to aspnet_isapi.dll) are the ones

being
secured.

The solution I found is to map all of the extension I'd keep in my secured directory to aspnet_isapi.dll.

I am planning to map .htm, *.exe, and *.shtm files to be processed by

.NET.
How is it going to affect the performance of the site? Is there

another way
of achieving the same thing?

Thanks,
Vic



Nov 17 '05 #8
Vic
Thanks Steve. It works perfectly.

Vic
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:Ol**************@TK2MSFTNGP12.phx.gbl...
change inline to attachment on the Response.Addheader line.
Like this:
Response.AddHeader("Content-Disposition","attachment;filename=myfile.doc");
--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com

"Vic" <ro****@gat.com> wrote in message
news:ul*************@TK2MSFTNGP10.phx.gbl...
Steve.

Is there an easy way to simulate the Save As behavior with
Response.WriteFile() ? I want user to prompted with the Save As dialog and
the file to be downloaded to the specified location on user's PC,
instead of
dumping it into the page.

Thanks in advance.

Vic
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
I accomplished this in a recent project by putting other files in a

private
directory.
Then when I needed to send one of the files to the user, I'd use
Response.WriteFile to grab the file from the private directory and

output
it
to the user. Of couse the ASPNET user account needs read access to the private directory.
I used code similar to this:
Response.Clear();
Response.AddHeader("Content-Disposition","inline;filename=myfile.doc"); Response.WriteFile("c:\privatedir\myfile.doc");

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
Hire top-notch developers at http://www.able-consulting.com


"Vic" <ro****@gat.com> wrote in message
news:uB**************@TK2MSFTNGP12.phx.gbl...
> I am trying to implement a forms-based authentication on my website,

so some
> directories will have web.config file which will deny certain users,

based
> on role, etc. The problem I encountered is that it's only asp.net files (or
> the files with the extension mapped to aspnet_isapi.dll) are the ones being
> secured.
>
> The solution I found is to map all of the extension I'd keep in my

secured
> directory to aspnet_isapi.dll.
>
> I am planning to map .htm, *.exe, and *.shtm files to be processed by .NET.
> How is it going to affect the performance of the site? Is there another way
> of achieving the same thing?
>
> Thanks,
> Vic
>
>



Nov 17 '05 #9
Vic
Thanks John.

I read article -- it sure does make sense making those downloads a separate
thread.

Vic
"John Saunders" <john.saunders at surfcontrol.com> wrote in message
news:ef**************@TK2MSFTNGP11.phx.gbl...
"Vic" <ro****@gat.com> wrote in message
news:O9*************@TK2MSFTNGP11.phx.gbl...
Thanks, John.

I think it's not such a hot idea, since some of the files are more than
20MB...

I'll probably use Steve's approach:
Response.WriteFile("c:\privatedir\myfile.doc");

Of course, this could also load the file in the memory first...


Victor,

In a similar case, I wrote a asynchronous HttpHandler (implementing
IHttpAsyncHandler) to handle product downloads from our site. I found the
following article very helpful in that:

Use Threads and Build Asynchronous Handlers in Your Server-Side Web Code
(http://msdn.microsoft.com/msdnmag/is.../default.aspx).

I hope that helps,
John

Nov 17 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Joshua Russell | last post by:
Hi, Both the methods below open up a windows form called MasterForm. However, one works better than the other. Method 1 opens the form correctly but I don't have any reference to the instance of...
7
by: Mike Bulava | last post by:
I have created a base form that I plan to use throughout my application let call the form form1. I have Built the project then add another form that inherits from form1, I add a few panel controls...
13
by: MD | last post by:
I have been converting a program from VB6 to VB.Net and enhancing it as well. All has been progressing OK although its been hard work. Now, all of a sudden, when I try to execute a ShowDialog()...
3
by: Lloyd Sheen | last post by:
I have the following situation: Need a user resizable user control. After much trying with user control I came across the idea of hosting the controls in a form marked as not TopLevel = false. ...
3
by: Geraldine Hobley | last post by:
Hello, In my project I am inheriting several forms. However when I inherit from a form and add additional subroutines and methods to my inherited form I get all sorts of problems. e.g. I sometimes...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.