Leema
Leema

Reputation: 97

download aspx page

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??

Upvotes: 0

Views: 385

Answers (1)

ajay_whiz
ajay_whiz

Reputation: 17941

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);

Upvotes: 0

Related Questions