K
kj96
I have a intranet page that I want to use to open a certain file from a
network location make changes to it and then write the changed file
back to the same network location
<my try at the code>
TextReader tr = new StreamReader("\\\\server\\location\\text1.txt");
StreamWriter tw = new StreamWriter("\\\\server\\location\\text2.txt");
</my try at the code>
I have setup IIS to use a domain user account that has read and write
rights to the server location.
I get the following error.
********************************************************************************
Server Error in '/web' Application.
--------------------------------------------------------------------------------
Logon failure: unknown user name or bad password.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.IO.IOException: Logon failure: unknown user
name or bad password.
Source Error:
Line 64: TextReader tr = new StreamReader
("\\\\server\\location\\file1.txt");
Line 66: StreamWriter tw = new
StreamWriter("\\\\server\\location\\file2.txt");
Source File: c:\inetpub\wwwroot\web\default.aspx.cs Line: 64
Stack Trace:
[IOException: Logon failure: unknown user name or bad password.
]
System.IO.__Error.WinIOError(Int32 errorCode, String str) +723
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share, Int32 bufferSize, Boolean useAsync, String
msgPath, Boolean bFromProxy) +859
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share, Int32 bufferSize) +44
System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean
detectEncodingFromByteOrderMarks, Int32 bufferSize) +79
System.IO.StreamReader..ctor(String path) +101
web.WebForm1.Button1_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\web\default.aspx.cs:64
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
+33
System.Web.UI.Page.ProcessRequestMain() +1263
Kevin Joyner
Systems Analyst
network location make changes to it and then write the changed file
back to the same network location
<my try at the code>
TextReader tr = new StreamReader("\\\\server\\location\\text1.txt");
StreamWriter tw = new StreamWriter("\\\\server\\location\\text2.txt");
</my try at the code>
I have setup IIS to use a domain user account that has read and write
rights to the server location.
I get the following error.
********************************************************************************
Server Error in '/web' Application.
--------------------------------------------------------------------------------
Logon failure: unknown user name or bad password.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.IO.IOException: Logon failure: unknown user
name or bad password.
Source Error:
Line 64: TextReader tr = new StreamReader
("\\\\server\\location\\file1.txt");
Line 66: StreamWriter tw = new
StreamWriter("\\\\server\\location\\file2.txt");
Source File: c:\inetpub\wwwroot\web\default.aspx.cs Line: 64
Stack Trace:
[IOException: Logon failure: unknown user name or bad password.
]
System.IO.__Error.WinIOError(Int32 errorCode, String str) +723
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share, Int32 bufferSize, Boolean useAsync, String
msgPath, Boolean bFromProxy) +859
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share, Int32 bufferSize) +44
System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean
detectEncodingFromByteOrderMarks, Int32 bufferSize) +79
System.IO.StreamReader..ctor(String path) +101
web.WebForm1.Button1_Click(Object sender, EventArgs e) in
c:\inetpub\wwwroot\web\default.aspx.cs:64
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
+33
System.Web.UI.Page.ProcessRequestMain() +1263
Kevin Joyner
Systems Analyst