punnu Posted November 14, 2003 Posted November 14, 2003 Hello Everybody! Look what my problem is ,i am writing a web application using ASP.NET in c#.In that i am trying to upload a file from my system to another system so for that i am using this code void btnUploadTheFile_Click(object Source, EventArgs evArgs) { string strFileNameOnServer = txtServername.Value; string strBaseLocation = ConfigurationSettings.AppSettings["filePath"]; ; if ("" == strFileNameOnServer) { txtOutput.InnerHtml = "give file name"; return; } if (null != uplTheFile.PostedFile) { try { uplTheFile.PostedFile.SaveAs(strBaseLocation+strFileNameOnServer); txtOutput.InnerHtml = "File <b>" + strBaseLocation+strFileNameOnServer+"</b> uploaded successfully"; } catch (Exception e) { txtOutput.InnerHtml = "Error saving <b>" + strBaseLocation+strFileNameOnServer+"</b><br>"+ e.ToString(); } } } Now what is happening at one system it is uploading the file without any logon requirement but on many other systems it is giving this error. System.IO.IOException: Logon failure: unknown user name or bad password. 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) at System.Web.HttpPostedFile.SaveAs(String filename) at ASP.uploadNsave_aspx.btnUploadTheFile_Click(Object Source, EventArgs evArgs) in c:\inetpub\wwwroot\WebApplication3\uploadNsave.aspx:line 24 Now my requirement is that before saving on any system it must ask for anyuser name and password or user name and passqord must be sent from the client system to that particular system and after checking the validity based on that user name and password it must save the file.Now i am unable to find out how this will be done .So please help me out in removing this problem. :confused: Quote
Travis Posted November 14, 2003 Posted November 14, 2003 Do you have this line in your Web.Config file? <identity impersonate="true" /> This is needed to have the application authenticate using the Network/NT login Quote
punnu Posted November 17, 2003 Author Posted November 17, 2003 try everything Hi! I have done what you have said but now it is giving following error. Error saving \\163.122.29.89\aaa\asd System.UnauthorizedAccessException: Access to the path "\\163.122.29.89\aaa\asd" 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) at System.Web.HttpPostedFile.SaveAs(String filename) at ASP.uploadNsave_aspx.btnUploadTheFile_Click(Object Source, EventArgs evArgs) in c:\inetpub\wwwroot\WebApplication3\uploadNsave.aspx:line 34 :( Quote
Moderators Robby Posted November 17, 2003 Moderators Posted November 17, 2003 If this is a shared web hosting environment they may have restrictions in place, check if they provide third party libraries for uploading files. Quote Visit...Bassic Software
punnu Posted November 17, 2003 Author Posted November 17, 2003 explain it Hi Robby. Since i am a new in this field so i don't know what do you mean by third party libraries.Can you please explain what does this mean. thanks. punnu:) Quote
Moderators Robby Posted November 17, 2003 Moderators Posted November 17, 2003 Are you on a shared host? Quote Visit...Bassic Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.