Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Access is Denied error with UploadFile

6 views
Skip to first unread message

John Ashbaugh

unread,
Aug 23, 2002, 5:56:14 PM8/23/02
to
Hello,


I am trying to upload a file from the web client and I get an access
is denied msg. People can access this folder through network so I am
confused why I am getting an error. Any help would be appreciated.

' Create a new WebClient instance.

Dim myWebClient As New System.Net.WebClient()

Response.Write(ControlChars.Cr + "Please enter the URL to post data to : ")

Dim uriString As String = "\\192.168.1.56\vctemp"

Response.Write(ControlChars.Cr + "Please enter the fully qualified path of
the file to be uploaded to the URL")

Dim fileName As String = "c:\config.txt"

' Upload the file to the Url using the HTTP 1.0 POST.

Dim responseArray As Byte() = myWebClient.UploadFile(uriString, "POST",
fileName)

Steve C. Orr, MCSD

unread,
Aug 23, 2002, 6:46:06 PM8/23/02
to
You need to make sure the ASPNET user account has the appropriate privileges
in this folder.

Hope this helps,
Steve C. Orr, MCSD
http://Steve.Orr.net


"John Ashbaugh" <jash...@hotmail.com> wrote in message
news:#JS1L$uSCHA.4260@tkmsftngp09...

John Ashbaugh

unread,
Aug 23, 2002, 7:04:42 PM8/23/02
to
Steve,

The aspnet account has administrator rights(I know this isn't a good
setup, but it's all on my local computer and testing only) If I try to use a
network drive it gives me the bad password or login. Where can I setup the
login as password for aspnet to use for hopefully get any of this resolved?
The \\192.168.1.56\vctemp folder is a folder that I setup as shared. People
can map the drive from their computers as well. Thanks in advance.


"Steve C. Orr, MCSD" <st...@orr.net> wrote in message
news:O34j9avSCHA.4168@tkmsftngp08...

vijit chhabra

unread,
Aug 24, 2002, 12:50:55 AM8/24/02
to
Hi John,

What you need to do is to go to the folder in your web applcation in which
you are trying to save the files. Then in the -->properties-->security, add
aspnet user of ur machine to it and give him full rights ... i.e. read /
write ...

It should work after that.

Regards,
Vijit

"John Ashbaugh" <jash...@hotmail.com> wrote in message

news:#q5KZlvSCHA.1496@tkmsftngp11...

John Ashbaugh

unread,
Aug 24, 2002, 9:57:50 AM8/24/02
to
Vijit,

Yes I saw that on the asp error however I do not have a security tab
anywhere on the folder. I am using xp pro and am hosting everything on one
computer. So I went to users and modified the aspnet_wp account and get it
admin rights. Am I missing something else?
"vijit chhabra" <vijit_...@hotmail.com> wrote in message
news:eilynoySCHA.2272@tkmsftngp11...

Jos Vernon

unread,
Aug 26, 2002, 3:23:46 AM8/26/02
to
> Yes I saw that on the asp error however I do not have a security
tab
> anywhere on the folder. I am using xp pro and am hosting everything on one
> computer.

Yes confusing isn't it? You have to go to the folder options and turn off
simple file sharing. Then all the standard permissions tabs turn up again.
It's a standard case of MS simplifying things and in the process making them
even more complicated.

If you've assigned Admin rights to your ASP.NET user it may be that these
rights won't take effect until you restart. Applying permissions to folders
is instant.

Best Wishes

Jos

----------------------------------------------------------------------
jos vernon
http://www.websupergoo.com
.NET Image Components & Consultancy
----------------------------------------------------------------------


John Ashbaugh

unread,
Aug 26, 2002, 5:15:40 PM8/26/02
to
Ok I am still getting access denied errors. The folder is shared and all
users have permissions. Under the securities option of the folder aspnet_wp
account has all permissions checked but the special permissions is greyed
out. I am going crazy! Is there anything else I am missing? XP PRO

<WebMethod()> Public Function GetFile()

Dim myWebClient As New System.Net.WebClient()

Dim uriString As String = \\192.168.1.56\test

Dim fileName As String = "c:\config.txt"

Dim responseArray As Byte() = myWebClient.UploadFile(uriString, "POST",
fileName)

End Function

"Jos Vernon" <jos_N...@websupergoo.com> wrote in message
news:eoCQdFNTCHA.3620@tkmsftngp08...

William LaMartin

unread,
Aug 27, 2002, 4:06:43 PM8/27/02
to
The Internet Guest Account needs write permission to the upload folder.

"John Ashbaugh" <jash...@hotmail.com> wrote in message

news:OAA2ZWUTCHA.1988@tkmsftngp09...

John Ashbaugh

unread,
Aug 27, 2002, 4:42:39 PM8/27/02
to
EVERYONE has all permissions, ASPNET_WP has all permissions, INTERNET GUEST
ACCOUNT has all permissions, ASPNET_WP is set as an administrator. Anyone
else need to be setup?


System.Net.WebException: Access to the path "\\192.168.1.56\test" is
denied. ---> System.UnauthorizedAccessException: Access to the path
"\\192.168.1.56\test" is denied.
at System.IO.__Error.WinIOError(Int32 errorCode, String str)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath,
Boolean bFromProxy)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share)
at System.Net.FileWebStream..ctor(FileWebRequest request, String path,
FileMode mode, FileAccess access, FileShare sharing)
at System.Net.FileWebRequest.InternalGetRequestStream()
--- End of inner exception stack trace ---

Server stack trace:
at System.Net.FileWebRequest.InternalGetRequestStream()
at
System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(Met
hodBase mb, Object[] args, Object server, Int32 methodPtr, Boolean
fExecuteInContext, Object[]& outArgs)
at
System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMess
age msg, IMessageSink replySink)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message
reqMsg, Boolean bProxyCase)
at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed,
MessageData& msgData)
at System.Net.AsyncGetRequestStream.EndInvoke(IAsyncResult result)
at System.Net.FileWebRequest.EndGetRequestStream(IAsyncResult
asyncResult)
at System.Net.FileWebRequest.GetRequestStream()
at System.Net.WebClient.UploadFile(String address, String method, String
fileName)
at System.Net.WebClient.UploadFile(String address, String fileName)
at VcNetService.VcNetService.GetFile() in
C:\Inetpub\wwwroot\VcNetService\VcNetService.asmx.vb:line 101


"William LaMartin" <lama...@tampabay.rr.com> wrote in message
news:O6U8tUgTCHA.1948@tkmsftngp12...

William LaMartin

unread,
Aug 27, 2002, 9:59:02 PM8/27/02
to
Well, you apparently have something different from my setup, because, as I
said, all I did was grant write permissions to the Internet Guest Account
for the upload folder.

It appears that your path is \\192.168.1.56\test. The path for my uploads
is something like c:\inetpub\wwwroot\WebApplication\uploads.

"John Ashbaugh" <jash...@hotmail.com> wrote in message

news:eA3EoogTCHA.4044@tkmsftngp12...

0 new messages