visual studio - Relative Paths in ASP.Net -


i trying design web form in asp.net using visual studio express 2012.

i need take data text boxes, , write text file.

this simple program, i having trouble setting file path.

this application sent else, , have run project computer.

the file want called database.txt , found in d:\project\bin\database.txt.

so if pastes folder in desktop, becomes c:\users\desktop\project\bin\database.txt.

i having trouble setting dynamic path can find file regardless of project folder is.

use code:

public void writetofile(string text) {     string logfilename = server.mappath("~/bin/database.txt");     using (streamwriter writer = file.appendtext(logfilename))     {         writer.writeline(text);         writer.flush();         writer.close();     } } 

Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

php - HTTP_REFERER woes: How can I allow access to a specific page, only when a visitor has visited another specific page beforehand? -

java Extracting Zip file -