An ASPX.CS file cannot create and write to a text file on the same server.
BACKGROUND INFORMATION:
The environment is a hosted server where the directories, for the time being, have read, write, and delete privileges. The ASPX.CS code only needs to create
a text file and write a line to it; periodically, the code also needs to append the file with a line. Attempts in using the StreamWriter and FileIOPermission classes have been used to perform this job, but the server responds with error messages of type 400
and 500. It seems that there is some security privilege acting as a barrier.
REQUEST:
Example code, or advice, is needed to implement this very elementary,
but tricky process.
Thank you for your response, but unless you are trying to have me perform a test, or you just didn't read the background information on this matter, you should have known this was not going to work. None the less, I ran the code for you and received a "500
- Internal Server Error."
That had no effect. But after removing the tag, matters became worse. Now the server refuses to send the directory structure where the test files are located.
I have already fiddled around with the Trust configuration without any success.
I think you are trying to help, and I appreciate that, but you are actually just sending me on a wild goose chase. Please don't send me to read other people's problems to determine if my problem is identical to theirs.
My expectation is that someone in this forum has a deep enough background knowledge of such problems, and that they
have the ability to provide real and systematic steps to "diagnose" this problem. It seems that nobody really knows how to perform basic diagnostic work. You know, like how a mechanic diagnoses electrical problems
in a car. That's the help I need.
Mean while, I'll continue to diagnose it on my own.
I understand that, you are looking for a silver bullet here, but it is worth mentioning that information you have posted here will not be any mean to a forum surfer or a professinal to guide you or to help. There are many professionals from different countries
using this forum and willing to provide some assitance as far as they can. What i suggest you is to get a quick free support be specific with problem else bullet goes without a target. Good luck with your own process.
Mr. Foxcroft
0 Points
10 Posts
Writing to a Server-Based Text File in C#
Jan 27, 2013 10:29 PM|LINK
PROBLEM:
An ASPX.CS file cannot create and write to a text file on the same server.
BACKGROUND INFORMATION:
The environment is a hosted server where the directories, for the time being, have read, write, and delete privileges. The ASPX.CS code only needs to create a text file and write a line to it; periodically, the code also needs to append the file with a line. Attempts in using the StreamWriter and FileIOPermission classes have been used to perform this job, but the server responds with error messages of type 400 and 500. It seems that there is some security privilege acting as a barrier.
REQUEST:
Example code, or advice, is needed to implement this very elementary, but tricky process.
cnranasinghe
Star
8885 Points
1798 Posts
Re: Writing to a Server-Based Text File in C#
Jan 28, 2013 03:58 AM|LINK
check following article
http://www.csharp-station.com/HowTo/ReadWriteTextFile.aspx
folder you are saving the text file to folder require to grant read/write permission.
Mr. Foxcroft
0 Points
10 Posts
Re: Writing to a Server-Based Text File in C#
Jan 28, 2013 05:28 PM|LINK
Hello Cnranasinghe:
Thank you for your response, but unless you are trying to have me perform a test, or you just didn't read the background information on this matter, you should have known this was not going to work. None the less, I ran the code for you and received a "500 - Internal Server Error."
Sincerely, Mr. Foxcroft
kiruba.sanka...
Member
543 Points
113 Posts
Re: Writing to a Server-Based Text File in C#
Jan 28, 2013 08:00 PM|LINK
Add following code in web.config
-Good Luck
Kiruba.
Mr. Foxcroft
0 Points
10 Posts
Re: Writing to a Server-Based Text File in C#
Jan 28, 2013 08:42 PM|LINK
That had no effect. But after removing the tag, matters became worse. Now the server refuses to send the directory structure where the test files are located.
Thank you.
cnranasinghe
Star
8885 Points
1798 Posts
Re: Writing to a Server-Based Text File in C#
Jan 29, 2013 01:39 AM|LINK
Check this thread any hint is available
http://forums.asp.net/t/1789036.aspx/1
Mr. Foxcroft
0 Points
10 Posts
Re: Writing to a Server-Based Text File in C#
Jan 29, 2013 04:26 AM|LINK
Dear Cnranasinghe:
I have already fiddled around with the Trust configuration without any success.
I think you are trying to help, and I appreciate that, but you are actually just sending me on a wild goose chase. Please don't send me to read other people's problems to determine if my problem is identical to theirs.
My expectation is that someone in this forum has a deep enough background knowledge of such problems, and that they have the ability to provide real and systematic steps to "diagnose" this problem. It seems that nobody really knows how to perform basic diagnostic work. You know, like how a mechanic diagnoses electrical problems in a car. That's the help I need.
Mean while, I'll continue to diagnose it on my own.
cnranasinghe
Star
8885 Points
1798 Posts
Re: Writing to a Server-Based Text File in C#
Jan 29, 2013 06:00 AM|LINK
I understand that, you are looking for a silver bullet here, but it is worth mentioning that information you have posted here will not be any mean to a forum surfer or a professinal to guide you or to help. There are many professionals from different countries using this forum and willing to provide some assitance as far as they can. What i suggest you is to get a quick free support be specific with problem else bullet goes without a target. Good luck with your own process.