views:

25

answers:

1

hi i'm using this code,

HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create("http://localhost:51659/jobpoint3.0/Default4.aspx");
WebClient client = new WebClient();
string filename = @"C:/Users/leema/" + txtsave.Text;    
client.DownloadFile("http://localhost:51659/jobpoint3.0/Default4.aspx", @"C:/Users/leema/"+ txtsave.Text);
//HttpResponseWriteFile(filename);
HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();
myHttpWebResponse.Close();

here i'm getting the local path.. how do i get user's desktop path for any user??

A: 

The code is

Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)

so your line no.3 will be modified to

 string filename = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), txtsave.Text);
ajay_whiz
but it is saying access to the path is denied after published
Leema
@Leema try to debug/print the >filename to see the location is correct. By the way in which OS are you running the application?
ajay_whiz