Howdo I create a file using Streamwriter.createtext('c:\Temp\Myfile.txt') on the servers here and set permissions? Thanks, Bill Ross aka WoundedEgo.com
Try this : Streamwriter.createtext(server.mappath("\myfile.txt")) Bruce DiscountASP.NET www.DiscountASP.NET
Thanks. That was almost it. I wound up with: StreamWriter sw = File.CreateText(MapPath("/Temp.txt")); Thanks again, Bill Ross
Yes,you have equal permissions to all the folders within your application root directory .But remember as a security measure, files in the App_Data folder are not served by the Web server. Vikram DiscountASP.NET www.DiscountASP.NET
Ok, well I was afraid I was asking a stooopid question, but there are some lessons: * if you want to create temp files, use server.mappath(@"/app_data/") * if you need to access the file system and allow other apps to access the files, use server.mappath(@"/somethingotherthanapp_data/") Yes? Is that the bottom line? Thanks, Bill Ross http://bibleshockers.blogspot.com
Hey Bill, just read some of your Blog posts, some good reading there bro. As for your site root question,try it like this instead: Server.MapPath("~/App_Data/yourtempfile.txt") That way, with~ asthe Application base path designator,you catch the correct site root App Data folder. In a data string |DataDirectory|\somefile will also catch somefile in the root App Data folder. It can be a lot of fun using that one. i.e. This connection string syntax is supported by the SqlClient and OleDb managed providers. By default, the |DataDirectory| variable will be expanded as follow: - For applications placed in a directory on the user machine, this will be the app's (.exe) folder. - For apps running under ClickOnce, this will bea special data folder created by ClickOnce - For Web apps, this will be the App_Data folder Under the hood, the value for |DataDirectory| simply comes from a property on the app domain. It is possible to change that value and override the default behavior by doing this: AppDomain.CurrentDomain.SetData("DataDirectory", newpath)<a target="_blank" href="https://blogs.msdn.com/smartclientdata/archive/2005/08/26/456886.aspx"> https://blogs.msdn.com/smartclientdata/archive/2005/08/26/456886.aspx</A>
Are there any directories with special privileges assigned, such as app_data, or do I have equal permissions anywhere I want to put a file? Thanks