I am trying to make LINK FINDER app in ASP
It working is divided into 5 step
- Send http request to server at www.foo.com
- Check status of request
- If its 200 then move to step 4 otherwise show error
- Parse all link
Send http request to server to parsed link
I am able to do first 4 step, But facing challenge in 5th step
I am getting 3 type of links
1.)absolute link : http://www.foo.com/file.asp
2.)links from root directory, which need domain name eg /folder2/file2.asp
3.)relative link : ../file3.asp
Challenge
When I am requesting www.foo.com , which is 301 redirected to www.foo.com/folder3/folder3/file3.asp
I am getting html content of redirected page, But don't get redirected url and not able to check 3rd type of links
Using following code
Set ServerXmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP.6.0") ServerXmlHttp.open "GET", "http://www.foo.com" ServerXmlHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded" ServerXmlHttp.send PostData If ServerXmlHttp.status = 200 Then //My CODE
Hope for quick response... or any other idea for link finder in asp , vb.net
It's out of the ServerXMLHTTP capabilities.
Instead you have to use IWinHttpRequest or another third-party component that able to manage redirects.
In the following example,
req.Option(WHR_URL)
returns the current url even if redirected.Option
req.option(WHR_EnableRedirects)
isTrue
by default like ServerXMLHTTP.So, I've added a line commented out showing how to disable redirects.