0

I am on a quest to pro-grammatically determine via C# whether a website such as http://about.com or a page such as http://mail.google.com requires authentication or not?

I was thinking on the lines of server responses 400, 401, 402 etc but I am not really sure.

Can somebody point me in the right direction please? The URL can be any and may nor may not be on SSL, and may have only a few pages that require authentication and not others.

Thanks

Steve

EDIT

Based on Will's suggestion, May I rephrase the question: How to determine whether we have received a web-redirect instead of the requested page ( and the kind of redirect) while creating an HttWebRequest using C#?

1 Answer 1

1

The easiest way is to try and go to a page that you "know is there" and see if you are redirected to someplace else that might happen to contain the words "log in", "sign in", etc.

Most sites simply direct you to a login page rather than sending you an HTTP response.

Sign up to request clarification or add additional context in comments.

1 Comment

+1 Yes. That is a great suggestion. I wonder why i didn't think of it! I have rephrased my question, can you further elaborate on how may i proceed further? Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.