How to save file to a shared foled in asp.net

P

Pei Lu

In ASP.NET , how to save a file in a shared folder in the server side, the
shared folder needs the username and password to access it. Is there any
sample code?
 
S

Steven Cheng

Hi Pei,

As for the "saving file to remote share" issue, I think it is a typical
"remote protected resource accessing problem in ASP.NET", here are some
options you can consider:

1. If the remote protected share is on a computer that can recognize domain
account or if you can create a duplicated account(have same username and
password) on both ASP.NET server machine and that share machine, then you
can use impersonate to run your ASP.NET thread under the certain user
account and access that remote share. For impersonate in ASP.NET, you can
have a look at the following article:

#How To: Use Impersonation and Delegation in ASP.NET 2.0
http://msdn.microsoft.com/en-us/library/ms998351.aspx

2. Another possible solution I've ever seen is create a mapped drive on
ASP.NET server(programmtically in ASP.NET code under the worker process
account), then access that local mapped drive(instead of the remote UNC
path). Here are some web threads mentioned this:

http://www.dreamincode.net/forums/showtopic9885.htm

http://www.microsoft.com/communities/newsgroups/en-us/default.aspx?dg=micros
oft.public.dotnet.framework.aspnet&tid=47313f14-660b-4495-838d-bd2669ca6bf0&
cat=en-us-msdn&lang=en&cr=US&sloc=en-us&m=1&p=1

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
 

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,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top