|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to catch page redirectString Something = ""; System.Net.WebClient WC = new System.Net.WebClient(); Something = WC.DownloadString(txtSomeAdress.Text); txtResult.Text = Something So, what is problem. If some page is redirecting to another page, than I got HTML of this new page and it is ok. But I need url of this new page. How to get it with C# or VB? Thanks I don't think this is possible.
The alternative is to use WebRequest instead of WebClient. WebRequest webRequest = WebRequest.Create("http://localhost:2121/"); var response = webRequest.GetResponse(); var reader = new System.IO.StreamReader(response.GetResponseStream()); var Something = reader.ReadToEnd(); var endUrl = response.ResponseUri.ToString(); I hope this helps. -- Show quoteHide quoteJay R. Wren "Abc" <i***@abc.com> wrote in message news:gvgmtq$pgo$1@sunce.iskon.hr... > I have some code for loading HTML od web page: > > String Something = ""; > > System.Net.WebClient WC = new System.Net.WebClient(); > > Something = WC.DownloadString(txtSomeAdress.Text); > > txtResult.Text = Something > > > > So, what is problem. If some page is redirecting to another page, than I > got HTML of this new page and it is ok. But I need url of this new page. > How to get it with C# or VB? > > > > Thanks > > Use HTTPWebRequest/HTTPWEBRESPONSE
You also need to use the status field from the response to identify the redirect, and then iterate the header and identify the target uri. I think thats it any way been a while since I built a proxy. Paul Show quoteHide quote "Jay R. Wren" <jrw***@xmtp.net> wrote in message news:92B56162-59CE-453A-AFC9-FDB6A4BA5FE2@microsoft.com... >I don't think this is possible. > > The alternative is to use WebRequest instead of WebClient. > > WebRequest webRequest = > WebRequest.Create("http://localhost:2121/"); > > var response = webRequest.GetResponse(); > > var reader = new > System.IO.StreamReader(response.GetResponseStream()); > var Something = reader.ReadToEnd(); > var endUrl = response.ResponseUri.ToString(); > > I hope this helps. > -- > Jay R. Wren > > "Abc" <i***@abc.com> wrote in message news:gvgmtq$pgo$1@sunce.iskon.hr... >> I have some code for loading HTML od web page: >> >> String Something = ""; >> >> System.Net.WebClient WC = new System.Net.WebClient(); >> >> Something = WC.DownloadString(txtSomeAdress.Text); >> >> txtResult.Text = Something >> >> >> >> So, what is problem. If some page is redirecting to another page, than I >> got HTML of this new page and it is ok. But I need url of this new page. >> How to get it with C# or VB? >> >> >> >> Thanks >> >> Hi,
That is probably expressly done to prevent persons from stealing Cor Show quoteHide quote "Abc" <i***@abc.com> wrote in message news:gvgmtq$pgo$1@sunce.iskon.hr... >I have some code for loading HTML od web page: > > String Something = ""; > > System.Net.WebClient WC = new System.Net.WebClient(); > > Something = WC.DownloadString(txtSomeAdress.Text); > > txtResult.Text = Something > > > > So, what is problem. If some page is redirecting to another page, than I > got HTML of this new page and it is ok. But I need url of this new page. > How to get it with C# or VB? > > > > Thanks > >
save treeview state and call from another form
is it save to call functions from another form? Bracketed types use variable as textbox name? Bitmap from a file windows.forms.controls Help with Event handler, withevents, raise events System icons in Listview This is a Bug, but whose? VB.Net or Mine? ISAM not found |
|||||||||||||||||||||||