It depends on how the site authenticates users. If they use basic authentication or Windows authentication, you can set the Credentials property of the HttpWebRequest class for the username / password / domain information, and it should work.
However, it looks like you need to enter the username / password on the site, which means that you need to log in to the site first. Looking at the main page, this is what I find in the <form> element that processes the login:
<form name="formlogin" method="post" action="./defalogin.php" > <input name="emtext" type="text" id="emtext" size="12"> <input name="pstext" type="password" id="pstext" size="12"> <input type="submit" name="Submit" value="Logn in" onClick="return logincheck()" > </form>
I have included only the relevant parts.
Given this, you should first go to the ./defalogin.php page with the HttpWebRequest and POST emtext and pstext . Also, make sure that you set the CookieContainer property in the CookieContainer instance. When this POST call returns, it will most likely be filled with a cookie, which you will need to send back to the site. Just continue to set the CookieContainer property in any subsequent instances of the HttpWebRequest on the CookieContainer to ensure that cookies are passed.
Then you will be taken to the page indicated in the link.
The javascript logincheck function is also logincheck , but looking at the sources of the script, it doesn't notice anything.
casperOne
source share