gaining access to a share

L

Lachlan James

Hi,

I want to create a folder on a network share from within
my ASP.NET application. The app uses a custom
authentication mechanism which creates a Principal object
after looking up an external system.

It seems whenever the Directory.CreateDirectory() method
executes I get an UnauthorizedAccessException exception. I
suspect this is because the ASPNET account is a local
account which is unknown to the computer where the share
resides.

How can I progamatically gain access to that share to
create the dir?

I do not want to configure impersonation in the web.config
as I fear this is less secure.

Thanks, Lachlan
 
P

Paul Clement

¤ Hi,
¤
¤ I want to create a folder on a network share from within
¤ my ASP.NET application. The app uses a custom
¤ authentication mechanism which creates a Principal object
¤ after looking up an external system.
¤
¤ It seems whenever the Directory.CreateDirectory() method
¤ executes I get an UnauthorizedAccessException exception. I
¤ suspect this is because the ASPNET account is a local
¤ account which is unknown to the computer where the share
¤ resides.
¤
¤ How can I progamatically gain access to that share to
¤ create the dir?
¤
¤ I do not want to configure impersonation in the web.config
¤ as I fear this is less secure.

You need to understand how delegation works so you can choose which authentication method best suits
your configuration:

http://msdn.microsoft.com/library/d...y/en-us/vsent7/html/vxconaspnetdelegation.asp
http://support.microsoft.com/default.aspx?scid=kb;en-us;810572


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 
L

Lachlan James

Hi Paul,

Thanks for your reply. Unfortunately we are using a custom
authentication system for this particular application
because the built in ones don't fulfil our needs. This
means using windows authentication & impersonation is not
possible. Besides that, it is not recommended to do it
that way for security reasons.

However towards the end of the article you posted it
mentioned using COM+ serviced components to achieve this,
so that's what I have done. I have a serviced component
which I call from my asp.net app. The serviced component
runs under a custom account which has access to the
network share. This is the easiest & most secure way to do
this I think.

For anyone else that is interested in doing this, below is
a great article which explains how to do it and why it is
the only viable option.

http://www.15seconds.com/issue/030926.htm

Lachlan

-----Original Message-----
¤ Hi,
¤
¤ I want to create a folder on a network share from within
¤ my ASP.NET application. The app uses a custom
¤ authentication mechanism which creates a Principal object
¤ after looking up an external system.
¤
¤ It seems whenever the Directory.CreateDirectory() method
¤ executes I get an UnauthorizedAccessException exception. I
¤ suspect this is because the ASPNET account is a local
¤ account which is unknown to the computer where the share
¤ resides.
¤
¤ How can I progamatically gain access to that share to
¤ create the dir?
¤
¤ I do not want to configure impersonation in the web.config
¤ as I fear this is less secure.

You need to understand how delegation works so you can
choose which authentication method best suits
 
P

Paul Clement

¤ Hi Paul,
¤
¤ Thanks for your reply. Unfortunately we are using a custom
¤ authentication system for this particular application
¤ because the built in ones don't fulfil our needs. This
¤ means using windows authentication & impersonation is not
¤ possible. Besides that, it is not recommended to do it
¤ that way for security reasons.
¤
¤ However towards the end of the article you posted it
¤ mentioned using COM+ serviced components to achieve this,
¤ so that's what I have done. I have a serviced component
¤ which I call from my asp.net app. The serviced component
¤ runs under a custom account which has access to the
¤ network share. This is the easiest & most secure way to do
¤ this I think.
¤
¤ For anyone else that is interested in doing this, below is
¤ a great article which explains how to do it and why it is
¤ the only viable option.
¤
¤ http://www.15seconds.com/issue/030926.htm
¤
¤ Lachlan

Yes I still use this type of mechanism for ASP and Visual Basic 6.0 components, although I kind of
moved away from COM+ since I moved to .NET.


Paul ~~~ (e-mail address removed)
Microsoft MVP (Visual Basic)
 

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,581
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top