Writing text file in Visual studio .net 2003
-
Ok go to the file you are trying to give access to write to. Right click on it goto the security tab. Click the add button. Add the user called IUSR_[machinename]. Give it read/write rights. To make this clear. If you servers name is myserver IUSR_[machinename] = IUSR_myserver Tell me if all is good.
The only way to speed up a Macintosh computer is at 9.8 m/sec/sec.
Well, I kept looking for the file and finally i tried to create the text file and tried to fallow your suggestion but I didn't see any ADD button when I right-click but I saw only the General tab and Summary tab has no security tab.After that i can't follow with your suggestion anymore :( here is more error deatial: ========================================================================================= Source Error: Line 21: { Line 22: // Put user code to initialize the page here Line 23: FileStream outStream=File.Create("c:\\mytext.txt"); Line 24: StreamWriter st=new StreamWriter(outStream); Line 25: st.WriteLine(DateTime.Now.ToString()); Source File: c:\inetpub\wwwroot\convert2chart\test.aspx.cs Line: 23 ========================================================================================= I really appreciated for your helping and hope you will understand and try to help me again,please. Thank you very much.
junior boy
-
Well, I kept looking for the file and finally i tried to create the text file and tried to fallow your suggestion but I didn't see any ADD button when I right-click but I saw only the General tab and Summary tab has no security tab.After that i can't follow with your suggestion anymore :( here is more error deatial: ========================================================================================= Source Error: Line 21: { Line 22: // Put user code to initialize the page here Line 23: FileStream outStream=File.Create("c:\\mytext.txt"); Line 24: StreamWriter st=new StreamWriter(outStream); Line 25: st.WriteLine(DateTime.Now.ToString()); Source File: c:\inetpub\wwwroot\convert2chart\test.aspx.cs Line: 23 ========================================================================================= I really appreciated for your helping and hope you will understand and try to help me again,please. Thank you very much.
junior boy
Change line 23 to: FileStream outStream = new FileStream("c:\\mytext.txt", FileMode.Create, FileAccess.Read);
The only way to speed up a Macintosh computer is at 9.8 m/sec/sec.
-
Change line 23 to: FileStream outStream = new FileStream("c:\\mytext.txt", FileMode.Create, FileAccess.Read);
The only way to speed up a Macintosh computer is at 9.8 m/sec/sec.
I coppied your code and paste it and then run it and this is the result : =================================================================================================== Combining FileMode: Create with FileAccess: Read is invalid. 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.ArgumentException: Combining FileMode: Create with FileAccess: Read is invalid. Source Error: Line 22: // Put user code to initialize the page here Line 23: //FileStream outStream=File.Create("c:\\mytext.txt"); Line 24: FileStream outStream = new FileStream("c:\\mytext.txt", FileMode.Create, FileAccess.Read); Line 25: StreamWriter st=new StreamWriter(outStream); Line 26: st.WriteLine(DateTime.Now.ToString()); Source File: c:\inetpub\wwwroot\convert2chart\test.aspx.cs Line: 24 =================================================================================================== And I tried to change the FileAccess to ReadWrite and it has debugged and the error detail the same the first post message I shown you. =================================================================================================== Access to the path "c:\mytext.txt" is denied. 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.UnauthorizedAccessException: Access to the path "c:\mytext.txt" is denied. ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via , the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user. To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access. Source Error: Line 22: // Put user code to initialize the page here Line 23: //FileStream outStream=File.Create("c:\\mytext.txt")
-
Well, I kept looking for the file and finally i tried to create the text file and tried to fallow your suggestion but I didn't see any ADD button when I right-click but I saw only the General tab and Summary tab has no security tab.After that i can't follow with your suggestion anymore :( here is more error deatial: ========================================================================================= Source Error: Line 21: { Line 22: // Put user code to initialize the page here Line 23: FileStream outStream=File.Create("c:\\mytext.txt"); Line 24: StreamWriter st=new StreamWriter(outStream); Line 25: st.WriteLine(DateTime.Now.ToString()); Source File: c:\inetpub\wwwroot\convert2chart\test.aspx.cs Line: 23 ========================================================================================= I really appreciated for your helping and hope you will understand and try to help me again,please. Thank you very much.
junior boy
Junior Boy wrote:
I saw only the General tab and Summary tab has no security tab
Are you logged in as administrator? I am not sure but that might be the reason why there is no security tab.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
-
Junior Boy wrote:
I saw only the General tab and Summary tab has no security tab
Are you logged in as administrator? I am not sure but that might be the reason why there is no security tab.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
yes,sure I am. But I didn't see any Security tab. Any suggestion from you or anything else I should know about,please? thank you,
junior boy
-
yes,sure I am. But I didn't see any Security tab. Any suggestion from you or anything else I should know about,please? thank you,
junior boy
I've googled: http://www.spaanjaars.com/QuickDocId.aspx?quickdoc=286[^] That should help.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus "Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
-
yes,sure I am. But I didn't see any Security tab. Any suggestion from you or anything else I should know about,please? thank you,
junior boy
Do you have the security tab after following those directions? If so, add the user I mentioned earlier and see if it works.
The only way to speed up a Macintosh computer is at 9.8 m/sec/sec.
-
Do you have the security tab after following those directions? If so, add the user I mentioned earlier and see if it works.
The only way to speed up a Macintosh computer is at 9.8 m/sec/sec.
Hi guys Finally I can wrote some text to the text file. Because I have to go back and check in the checkbox below to full control and it worked But you guys please,i have another problem it is I have to create the text file first, I mean I need to have a textfile and I have to go right-click and do the same again and again. My purpose is doesn't matter I have the textfile or not just create and write some textual into it. And the error is the same such as the first time. Can you tell me how to do? Thank you very much.
junior boy
-
Hi guys Finally I can wrote some text to the text file. Because I have to go back and check in the checkbox below to full control and it worked But you guys please,i have another problem it is I have to create the text file first, I mean I need to have a textfile and I have to go right-click and do the same again and again. My purpose is doesn't matter I have the textfile or not just create and write some textual into it. And the error is the same such as the first time. Can you tell me how to do? Thank you very much.
junior boy
You should be able to apply the security settings to the directory the file is in.
-
You should be able to apply the security settings to the directory the file is in.
Thank you for all helps from all you guys. Now I decided to use VB .net 2005 to avoid this problem and some people told me that it is bugging on VB .net 2003 Probably its right because I have no problem when I tried to use VB .net 2005 Really glad for helping. Good luck,have nice day all you guys,
junior boy