Need URL help

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have a Text Box wich include an URL ,user enter a link address . my application should open this link to save in the disk.
how can I do that to get a link and save the page in the disk ???
 
Use a WebClient.

System.Net.WebClient client = new System.Net.WebClient();
client.DownloadFile(address, savefilename);

This saves the file to disk, but does not open it.
To get the filename from the address you could use

string savedfilename = System.IO.Path.GetFileName(address);

but this may produce illegal filenames since this isn't really for urls.
There may be more suitable methods for urls or you can create your own.
(Or ignore it alltogether and save the files with new names)
 
I have a Text Box wich include an URL ,user enter a link address . my
application should open this link to save in the disk. how can I do
that to get a link and save the page in the disk ???

Take a look at WebRequest class
 
Back
Top