May 8th, 2014, 05:06 AM
simulating an href link with WebRequest
I have a question about simulating the "<a hfer=..." Html tag behaviour in a C# application.
i have a web page "A" which I can get normally using a browser . This page has a link ( actuallly an anchor , "<a href= ..." tag) to the page B, which is basically a page presenting a login form.
I generally access "A" , then click on the link to "B" and everything works fine so that I can login.
I even discovered, by looking into the "A" html code, that I can directly use the url written into the href attribute of the anchor to page "B":that is, if I put that url in the browser's adderss bar, I can directly access page "B" without first passing through "A", and login sucessfully.
Now , what I want to do, is access the page "B" programmatically, through the use of href url, , using a WebRequest . I have been told that the href attribute in a html anchor uses a Http GET verb . So my thought is that , if I use a code like the following :
WebRequest WRq = WebRequest.Create(UrlForPost2);
WRq.Method = "GET";
WebResponse WRe = WRq.GetResponse ();
I should be able to download directly the page "B" .
But this never happens . I always get a Http Error 500 (Internal Sserver Error).
Isn't the href attribute of an anchor a web request too ? which kind of request is that, and how can I simulate it into an application ?
May 9th, 2014, 01:50 AM
Re: simulating an href link with WebRequest
Passwords are probably saved on the machine for your user
Tags for this Thread
Click Here to Expand Forum to Full Width