Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi All,
I am using vs2008,c#.net with window form .net platform.
How can create text file on C:\WINDOWS (Window 7 based pc)location through code.
Could we can use app.config file for using create file on C:\WINDOWS location with permission.

any suggestion or idea.
help will be appreciated

Mukesh
Posted
Comments
Sergey Alexandrovich Kryukov 25-Jan-12 13:24pm    
What is "using create file"? How this is related to app.config?
--SA
loctrice 25-Jan-12 13:39pm    
- built in file creation (which one I'm not sure)

- Didn't say it was related. He was asking if it could be used. Looks like he is fishing for some sort of solution to his problem.

I read from this that he is trying to use the built in file/stream/something to create a file, and since windows7 has different permission rules, is having trouble.

"what are you trying currently", "what is the specific problem", or something like that.

He probably finds your comment as useful as you found his question.

1 solution

I don't think you ever need to create a file in this location, especially with Windows 7.

You cannot create permissions out of nothing in your code. If you need to know how to run a program with elevated privileged (just logging as administrator is not enough), you need to know this: http://www.sevenforums.com/tutorials/11841-run-administrator.html[^].

Please see my comment to the question. The problem here is this: if you don't know how to create file, I don't know what do you know. Well, there are many ways, see System.IO, http://msdn.microsoft.com/en-us/library/system.io.aspx[^].

I also don't know how this is related to "app.config". Do you have a problem understanding how this thin works? — read this: http://msdn.microsoft.com/en-us/library/1xtk877y.aspx[^].

—SA
 
Share this answer
 
v2
Comments
Espen Harlinn 25-Jan-12 13:57pm    
Good answer - my 5!
Sergey Alexandrovich Kryukov 25-Jan-12 14:02pm    
Thank you, Espen.
--SA
NeptuneHACK! 25-Jan-12 14:08pm    
my 5, awesome!
Sergey Alexandrovich Kryukov 25-Jan-12 14:10pm    
Thank you,
--SA
loctrice 25-Jan-12 18:31pm    
I agree with Espen and NeptuneHACK. My 5 as well.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900