Handle a meta refresh 0  
Author Message
WillHelm





PostPosted: Visual C# General, Handle a meta refresh 0 Top

I have a method of using WebRequest and WebResponse to post login info to a page and once i do i am given a response with:

<meta http-equiv="Refresh" content="0;URL=http://..ADDRESS_HERE...">

To which I can not figure out how to handle using the two fore-mentioned objects!

How does one handle this type of meta tag

If needed I can post my code!

---
william


Visual C#16  
 
 
James Curran





PostPosted: Visual C# General, Handle a meta refresh 0 Top

After requesting and parsing the meta refresh, then just:

WebRequest request = WebRequest.Create ("http://..ADDRESS_HERE...");



 
 
WillHelm





PostPosted: Visual C# General, Handle a meta refresh 0 Top

I've tried that and it goes straight to another login page saying you have to be logged in to do that!

 
 
James Curran





PostPosted: Visual C# General, Handle a meta refresh 0 Top

It's probably sending a cookie (which would be in the WebResponse.Headers property), which must be copied to the WebRequest object.

 
 
WillHelm





PostPosted: Visual C# General, Handle a meta refresh 0 Top

Yeah, I already have a method incorporated for handling the cookies; i also just noticed this site has different frames on the pages and I'm not sure if that has anything to do with my method not working!

Another option I was looking into since this is such a pain in the butt, was to just use a WebBrowser control and have it hidden and walk the DOM; albeit, if the Control is hidden it causes the main window/application to lose focus and show the wait icon while the page loads; not sure on how I should handle that either...

This site also does the redirects and refreshes on every page load! I'm pretty sure they are trying to prevent screen scraping, by judging the type of code that's persistent throughout the entire site... but it's for my own personal use as I can't stand to navigate this site through my browser and do all the tedious tasks required to do what I want/need to do on there!

Is there a managed and elegant way to handle the WebBrowser control and stop the app from losing focus and showing the wait icon when a page loads and while the control is hidden from view

---
william,