473,508 Members | 4,712 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Upload/Download Security Question

Hello, I am following along with an example of how to do uploads and download
from your application.

The download seems to wok just fine, but the upload does not. Each time I
attempt to upload, I get and exception with the error message being "{"Logon
failure: unknown user name or bad password.\r\n" }". I am trying to move the
file to shared directory on another server, and I am guessing that perhaps I
need to do something on my shared server to allow my application to be able
to write files to it. What exactly do I need to do, or is there some other
error? Here is the code I an using to upload files....

string loadDir = @"e:\products\Speed\Attachments";
System.Web.HttpPostedFile postedFile = uploadedFile.PostedFile;
string filename = Path.GetFileName(postedFile.FileName);
string contentType = postedFile.ContentType;
int contentLength = postedFile.ContentLength;
postedFile.SaveAs(loadDir + _DirectorySeparatorChar.ToString() + filename);

Are there some considerations that I should make for where I locate the
directory where I uploade files? I think I have heard that is should
segregated from where my application is, does this mean the same server or
should it be isolated to a different server?

Thanks in advance for your assistance!!!
Nov 19 '05 #1
4 1609
By default the ASPNET user account does not have access to network
directories. Either grant it access or have ASP.NET run under a different
user account by using impersonation.

For example, you can add a line similar to this to your web.config file:
<identity impersonate="true" userName="domain\MyAppUser">
password="password"/>

For testing purposes you can have it use your user account since you know
you have the necessary permissions to write to that network location.

Here's more info on impersonation:
http://msdn.microsoft.com/library/de...ersonation.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Jim Heavey" <Ji*******@discussions.microsoft.com> wrote in message
news:6C**********************************@microsof t.com...
Hello, I am following along with an example of how to do uploads and
download
from your application.

The download seems to wok just fine, but the upload does not. Each time I
attempt to upload, I get and exception with the error message being
"{"Logon
failure: unknown user name or bad password.\r\n" }". I am trying to move
the
file to shared directory on another server, and I am guessing that
perhaps I
need to do something on my shared server to allow my application to be
able
to write files to it. What exactly do I need to do, or is there some
other
error? Here is the code I an using to upload files....

string loadDir = @"e:\products\Speed\Attachments";
System.Web.HttpPostedFile postedFile = uploadedFile.PostedFile;
string filename = Path.GetFileName(postedFile.FileName);
string contentType = postedFile.ContentType;
int contentLength = postedFile.ContentLength;
postedFile.SaveAs(loadDir + _DirectorySeparatorChar.ToString() +
filename);

Are there some considerations that I should make for where I locate the
directory where I uploade files? I think I have heard that is should
segregated from where my application is, does this mean the same server or
should it be isolated to a different server?

Thanks in advance for your assistance!!!

Nov 19 '05 #2
By default the ASPNET user account does not have access to network
directories. Either grant it access or have ASP.NET run under a different
user account by using impersonation.

For example, you can add a line similar to this to your web.config file:
<identity impersonate="true" userName="domain\MyAppUser">
password="password"/>

For testing purposes you can have it use your user account since you know
you have the necessary permissions to write to that network location.

Here's more info on impersonation:
http://msdn.microsoft.com/library/de...ersonation.asp

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Jim Heavey" <Ji*******@discussions.microsoft.com> wrote in message
news:6C**********************************@microsof t.com...
Hello, I am following along with an example of how to do uploads and
download
from your application.

The download seems to wok just fine, but the upload does not. Each time I
attempt to upload, I get and exception with the error message being
"{"Logon
failure: unknown user name or bad password.\r\n" }". I am trying to move
the
file to shared directory on another server, and I am guessing that
perhaps I
need to do something on my shared server to allow my application to be
able
to write files to it. What exactly do I need to do, or is there some
other
error? Here is the code I an using to upload files....

string loadDir = @"e:\products\Speed\Attachments";
System.Web.HttpPostedFile postedFile = uploadedFile.PostedFile;
string filename = Path.GetFileName(postedFile.FileName);
string contentType = postedFile.ContentType;
int contentLength = postedFile.ContentLength;
postedFile.SaveAs(loadDir + _DirectorySeparatorChar.ToString() +
filename);

Are there some considerations that I should make for where I locate the
directory where I uploade files? I think I have heard that is should
segregated from where my application is, does this mean the same server or
should it be isolated to a different server?

Thanks in advance for your assistance!!!

Nov 19 '05 #3
Thanks...But why does it work when I am physically signed on? Is it not
using the ASP.Net account then?

Do I just grant MachineName\aspnet the access event though my ID is logged
on to the domain account?
Nov 19 '05 #4
Thanks...But why does it work when I am physically signed on? Is it not
using the ASP.Net account then?

Do I just grant MachineName\aspnet the access event though my ID is logged
on to the domain account?
Nov 19 '05 #5

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

Similar topics

8
5208
by: Todd Acheson | last post by:
I'm having a small problem with uploading files in ASP.NET. My html page for uploading has something similar to: <form id="Form1" method="post" enctype="multipart/form-data" runat="server">...
0
227
by: Jim Heavey | last post by:
Hello, I am following along with an example of how to do uploads and download from your application. The download seems to wok just fine, but the upload does not. Each time I attempt to upload,...
6
3597
by: Paul | last post by:
Hi there, When adding a "File Field" HTML control to an aspx page to facilitate file uploading, the following occurs: 1. You select a file that is larger than the allowed size limit. 2. Once...
3
3548
by: Demetri | last post by:
Hello, I'm involved in developing an application which has the need to transfer files automtically once a laptop is connected back to the network. The application i'm developing will...
0
9768
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
9
3876
by: Steve Poe | last post by:
I work for an animal hospital trying to use PHP to store an animal's dental x-rays to a file server. I can browse for the xray on the local desktop computer then click "Upload Image". This...
1
1881
by: lPrentice | last post by:
Hello, After all this time, Linux file permissions still confuse me at times. I have a Python web-based application with an file (images) upload module. The application is running on two remote...
12
2460
by: GuangXiN | last post by:
I want the file upload element disappear, instead of it, I place a text box and a button with my own css defination. but it doesn't work on IE7. What should I do now? <form action="upload.php"...
3
1495
by: mp33487 | last post by:
I'm trying to upload/download files programmaticly to a records management system. I have it working fine on my dev machine using vb.net code-behind pages but when I place it on the server when it...
2
5156
dlite922
by: dlite922 | last post by:
I have an intranet LAMP server and I use PHP to upload files. It is of course faster to download the same file than to upload it. I understand ISPs throttle their network for download speed, than...
0
7228
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
7332
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
7393
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
5635
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4715
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3191
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1565
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
426
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.