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#?

kamaci
  • 65,625
  • 65
  • 210
  • 342
Steve Johnson
  • 2,704
  • 5
  • 40
  • 67

1 Answers1

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.

Will Hartung
  • 107,347
  • 19
  • 121
  • 195
  • +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 – Steve Johnson Dec 23 '12 at 21:38