Upload Files Using ASP.NET Impersonation and UNC Share
page 1 of 2
Published: 17 Dec 2003
Unedited - Community Contributed
Abstract
Uploading files with ASP.NET is easy, but permission problems can prevent uploads to network shares. This article describes the steps that are necessary to use ASP.NET to upload files to UNC shares.
by Siva Manikanteswaran
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 59605/ 77

Introduction

Download Sample

/download/336/uploadtest.zip

 

The Problem

 

When using upload functionality provided by Asp.net a common approach that is followed is to have the uploaded file in a virtual folder located in a remote machine other than the web server. The uploaded files needs to be stored in a remote location and mapped to the web server using a virtual folder pointing to a UNC share.

 

UNC Share

A directory shared in a remote machine can be accessed using UNC name such as \\RemoteMachineName\SharedFolder.

 

Virtual Folder

 

IIS provides a mechanism to point to the UNC share by creating a virtual folder with an alias pointing to UNC .Please note on 'Connect as user' specify just user name and password -- don’t give Remotemachinename\user.

 

 

Uploading using asp.net

 

Asp.net provides an easy upload feature which many of us have used .The problem happens when we try to upload a file using this virtual folder pointing to UNC share. Asp_wp account does not have access to the network resources by default.


View Entire Article

User Comments

Title: dsf   
Name: dfd
Date: 2012-07-09 2:10:40 AM
Comment:
dfd
Title: unc share   
Name: Wesley
Date: 2011-12-18 12:01:28 PM
Comment:
Erro instalation Orbit Download: The drive Unc share you selected does not exist or is not accessible.pls tell me how to fix problem
Title: create folder on network PC   
Name: Sandeep
Date: 2010-11-19 12:18:06 AM
Comment:
I want to create network folder. See i have one web Server and one file server. So i want to create folder on file server using ASP.net, can anybody help..
Thanks in advance
Title: unc share   
Name: xayoulan nanthasack
Date: 2010-10-16 11:05:28 PM
Comment:
Erro instalation Orbit Download: The drive Unc share you selected does not exist or is not accessible.pls tell me how to fix problem
Title: Unc share   
Name: Antonio Landes
Date: 2010-05-06 8:12:30 PM
Comment:
Erro instalation Orbit Download: The drive Unc share you selected does not exist or is not accessible.
l.andes@hotmail.com
Title: MR   
Name: Yah hneh
Date: 2010-04-14 4:36:16 AM
Comment:
I tried, but cudnt get it right.
Title: How to write/modify to network files?   
Name: Prasad
Date: 2010-02-18 6:02:27 AM
Comment:
Hi, this code works when we want to "read" network files.

What needs to be done if I want to "write/modify" these network files?

Thanks
Prasad
Title: sry!!!!   
Name: hrithik
Date: 2009-12-02 9:08:31 AM
Comment:
your approach is fyn bt can you explain wht to do when the folder we tend to share is on other network drive and the working folder is in other...
wht 2 do in this case??
have any ans then do share.......
Title: verify if file exists on network folder   
Name: riyaz
Date: 2009-07-09 4:01:33 AM
Comment:
\
\
\
\
Title: verify if file exists on network folder   
Name: riyaz
Date: 2009-07-09 3:54:36 AM
Comment:
\
\
\
\
\
\
\
Title: problem while only reading / downloading the file from remote server using impersonation   
Name: Pallav
Date: 2009-06-09 4:33:36 AM
Comment:
Hi I am able to upload files to one remote file share using impersonation of .net but i am not able to read / download that file using the same function. It is asking me to enter again user name / pwd. Please help me whether i need to change some settings at file share side or not
Title: Loading file from webserver is very slow?   
Name: mH
Date: 2008-11-20 3:03:42 AM
Comment:
When directory shared is bigger. Loading file from webserver is very slow. How to increasing the loading rate
Title: A better way   
Name: EMG
Date: 2008-11-18 9:32:48 AM
Comment:
Set the identity in the app pool to a use a service account and then add that service account to the local IIS_WPG group. Recycle pool...viola!
Title: Good Explanatory article.   
Name: Asif Syed
Date: 2008-10-17 8:09:47 AM
Comment:
a very good and discriptive article on web & file server concept. I was struggled for this concept for over two days as roaming on net walls, it's my luck i caught this link.
Thank you very much.
Title: Question?   
Name: gsk
Date: 2008-08-12 2:21:41 PM
Comment:
The solution is good? Thanks...
But what if i wanted to use the same approach, but without setting the impersonate to true then how to proceed any idea?

Thanks,
gsk
Title: Thank you   
Name: VietOri
Date: 2008-07-04 6:18:20 AM
Comment:
It's solution for upload in distributed server
Title: Great work...   
Name: Manpreet
Date: 2008-05-29 4:19:43 AM
Comment:
I was trying to do this for last two days. I searched a lot on internet but nobody mention about the permission on the temporary folder.and that was the thing i was missing..thanks..
Title: Resolving Network Path   
Name: HR
Date: 2008-05-20 1:28:10 AM
Comment:
\
\
Title: uploading files   
Name: nilesh
Date: 2008-04-09 7:01:47 AM
Comment:
tell me how i can upload file in domain using asp.net(vb.net)
Title: Unable to store file in network drive   
Name: Rehan
Date: 2007-12-12 8:10:52 AM
Comment:
\
\
\
\
Title: Access denied!! ...sigh...   
Name: Leon Pretorius
Date: 2007-09-03 5:15:53 PM
Comment:
I gave 2 specific users rights on the server. I created a roaming profile and a network drive. The profile worls fine but the 2 specific users cant save to a folder on the mapped drive (mining, which is all they are alowed to use anyway) Now they can read but cannot write to this folder but they have full rights on it. This has been a head ache ever since i did the server installation. HELP PLZ!!!

Please if possible reply on my mail : lspretorius@gmail.com

Kind Regards

Leon
Management
..IT Company
Title: URL   
Name: Haresh V
Date: 2007-07-04 9:36:20 AM
Comment:
Sorry, I thought url entry will be shown. Please note my url: http://admin.ojeez.com/upload.aspx
Title: Not able to access the path   
Name: Haresh V
Date: 2007-07-04 9:35:03 AM
Comment:
Mr. Shiva,

Thanks for this article. I tried the same as you mnetioned above. But its giving me the error: Access to the path is denied.

Would you be so kind to take a look at my url and can you please guide me where I am missing the configuration?

Thanks,

Haresh
Title: Not able to access the path   
Name: Haresh
Date: 2007-07-04 9:33:23 AM
Comment:
\
\
\
\S
Title: Very helpful.. thank you so much   
Name: Cindy Chan
Date: 2007-06-26 5:43:55 AM
Comment:
Our team have been searching for the solution for so long and finally your article had save our life!
Title: Programmer   
Name: Spark
Date: 2007-06-12 3:59:58 PM
Comment:
Excellent. Thank you very much.
Title: Windows 2000 solution   
Name: Author
Date: 2007-04-23 12:49:28 AM
Comment:
I meant you dont do need anything if you have windows 2003 or xp.The step was to be done only for windows 2000
Title: Requirement of Help in developing of Remote File Sharing   
Name: Abid Mahmood
Date: 2006-10-17 1:26:25 AM
Comment:
Dear Sir;
I appreciate about your article relating to uploading of file on net.

Respected Sir, i am student of 8TH Semester of BCS. i choose my final Project "Remote File Sharing".I want to develop it using .NET Framework by using any language of it.
and i need Help relating to it.
kindly send me article related to my project or help me.

Best Regard.
ABID MAHMOOD
BCSS03A131
saith_abid131@yahoo.com
Title: Still not working   
Name: Thiru
Date: 2006-07-06 9:51:54 AM
Comment:
I tried out the steps that you have mentioned but still iam not able to read write to file system. i get an access denied message.

i created a local user as mentioned and gave it limited rights (followed this link also http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetHT01.asp)

but still it doesnt work.....but if i use my domain user id and password then it works....but i dont want to use them....

pls help
Title: how to use unc in code   
Name: ramesh
Date: 2006-06-07 7:24:58 AM
Comment:
hello sir u have given clear explination but how we can use unc share in our programme
Title: Configuration error   
Name: Pothiraja
Date: 2006-06-06 1:18:31 AM
Comment:
Dear friend,
I'm also trying to map the network file to the web server. As per your instructions.
I created the username same as you given(both Fileserver/Web server).
But i got the error message. Configuration error. Error message
The located assembly's manifest definition with name 'Assemblyname' does not match the assembly reference.

could you please help me out. Where i'm mistaking.
Title: Good Tips   
Name: Santhosh Kumar
Date: 2006-05-24 10:36:19 AM
Comment:
I tried this article. And my web application is wroking fine.

Thanking You

Santhosh Kumar

santhoshvnath@yahoo.com
Title: thank you   
Name: NKT
Date: 2006-03-10 10:26:11 AM
Comment:
Great article. Thank you. The problem was exactly my problem. It works, thank you again
Title: Better Link   
Name: Jay Dubal
Date: 2006-02-14 2:28:48 PM
Comment:
Hello,

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetHT01.asp

Thanks,
Jay Dubal
Tech Lead
Gateway Technolabs Pvt. Ltd.
Title: clarification   
Name: Siva
Date: 2005-09-30 10:25:16 AM
Comment:
see point 4

If you have Windows 2000 go to local security setting and browse to “User Rights assignment” and locate “Act as part of Operating System” policy. Double click and add “aspnet_wp” account
Title: re   
Name: vodka
Date: 2005-09-30 9:23:26 AM
Comment:
If you are using windows xp or windows .net server 2003 you don’t need do anything


what do u mean with that?

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-10-15 9:56:54 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search