Member Avatar for nssltd

Hey there in may web browser program their is something i am struggling on. That thing is you know when you go on a log on website and the address bar goes green? Well that is what i want to do but i am struggling on how to determine whether the website has SSL.

Any help is much appreciated

NSSLTD

Recommended Answers

All 10 Replies

Where is it hosted? You usually have to order a Certificate from a provider like RapidSSL, GoDaddy, Geotrust, etc.

The process will involve a bit of back and forth from your hosting provider unless you manager your own server.

Some shared hosting accounts provide a free shared SSL, but that changes your URL from yourdomain.com to yourdomain.hostingdomain.com.

$50(ish) per year gets you a cert at GoDaddy.

Member Avatar for nssltd

Sorry i think you've misunderstood my question you know when you navigate to a secure page in your browser and your browsers text box turns green because its secure? well thats what i want to achieve.

Take a look at the attached image

Any help is much appreciated

NSSLTD

Exactly. If you want that to "Turn Green" you need an SSL certificate installed. You need to purchase one and have it installed your web server.

Member Avatar for nssltd

No this is a web browser program like firefox. Its the address box that needs to be turned green. It needs to see whether the page is SSL and if it is turn the address box green

// once it finds out whether it is ssl
this.adrbox.BackColor = Color.lightgreen;

thats what i want to find out i need to determine whether a page is SSL or not.

Oh, your writing a browser. That wasn't clear to me, Sorry.

Use something like:

HttpRequest request = application.Request;
if (request.IsSecureConnection)
{
     //do something
}
Member Avatar for nssltd

Sorry I dont understand your Code.

HttpRequest request = application.Request;
   
      if (request.IsSecureConnection)
   
      {
   
      //do something
   
      }

I know you must import System.Web;

But i dont understand how to implement the code are there some Syntax errors because all im getting is this from my compiler
Error 3 The type or namespace name 'HttpRequest' could not be found (are you missing a using directive or an assembly reference?) line 1559 13 PJSWebX

and

Error 4 The name 'application' does not exist in the current context 1559 35 PJSWebX

Please can you help me further with this code?

NSSLTD

What objects are you using for web browsing? The built in .NET browser? Try pasting in the code where you are trying to accomplish this.

Member Avatar for nssltd

Ok i cant paste my Form 1 code as it is over 2000 lines of code. I am using the .Net browser in this context

((WebBrowser)(browsertabcontrol.SelectedTab.Controls[0]));

i am trying to do this in a timer event. If SSL is discovered the address bar goes green and the status bar confirms it is secure. I am using a bool the bool's name is issecure.
Im not sure how to do the .IsSecure that you mentioned. Let me know if you need anymore info

NSSLTD

Here try this: (sample VS 2010 project attached.)

webBrowser1.Navigate(textBox1.Text);

                if(webBrowser1.EncryptionLevel != WebBrowserEncryptionLevel.Insecure)
                    label1.BackColor = Color.Green;
                else
                    label1.BackColor = Color.White;

EDIT:
You'll need to check for mixed authentication mode as well but this should get you on the right track.

Member Avatar for nssltd

Thanks Your code has been tried and tested and works! Thanks again for all your help!

NSSLTD

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.