Web Page Login Tester Fails When Scheduled

Doug

Active member
Joined
Oct 5, 2011
Messages
44
Programming Experience
Beginner
My orgainization uses a simple windows form to test if our site is up. The form has a web browser control on it. After it loads, the browser control browsers to the site and logs in. Yes, it uses the document complete event to know when the pages are done loading. It verifies whether the log-in is successful if it can find the log-out button on the web page. If it fails at any point, it writes the error to the event log.

The form works perfectly fine when I execute it manually. It fails to log in when the form's executable is scheduled. It gets to the log-in page, enters the correct credentials, and clicks the log-in button. At that point, the page returned should have been the standard home page. Instead, it is the sign-in page with "?ReturnUrl=/home.aspx" added to the end of the URL. We don't have any idea where that comes from since failed log-ins posts back the log-in page without the ""?ReturnUrl=/home.aspx". Successful log-ins takes you to the standard home page.

Our page uses SSL, so it is a https:// page. The account that the form is scheduled under has administrative rights.

Has anyone run into a problem like this? Any suggestions?
 
I did more research. It looks like what we are attempting is not possible. Forms authentication cannot be used in a scheduled task because page redirects are not allowed. I don't understand this entirely, but that seems to be the answer I am finding after significant web searches.
 
We eventually got the login tester working using HttpWebRequest. We rewrote the code as a consol application using HttpWebRequest and parsing the response. It was not easy, but we learned a lot about web requests in the process.
 
Back
Top