tags:

views:

4701

answers:

3

Hi all

My Asp.Net web application has so many web pages.

But i want to use HTTPS for only Login.aspx page.

How can i do??? Pleaes Help me..... thanks

+1  A: 

You can enable HTTPS in your IIS config, but it won't be "secure" unless you acquire an SSL Certificate and plug it into IIS. Make sure you have port 443 open.

tsilb
+4  A: 

You can publish your own certificate or you can purchase one. The caveat is that purchasing one, depending on the company, means that it's already stored in the certificate store for most browsers. Your self published one will not be and your users will have to take the extra step of installing your cert.

You don't say what version of IIS you're using, but here are some detailed instructions for IIS 6

You can purchase relatively cheap certs or you can go with the big boys (verisign) and get an extended validation certificate which turns your address bar in IE, green. It's also a somewhat rigorous validation process and takes time.

If you know all of the users that will be hitting your website, there's no problem with installing your own. However, for an open website with anonymous users (that you don't know), it's probably best to purchase one that is already in most major browsers, certificate stores.

You can enable SSL via IIS and require it for only your login.aspx page and not for the rest.

GregD
+2  A: 

After you get SSL setup/installed, you want to do some sort of redirect on the login page to https://. Then whatever page the user is sent to after validation, it can just be http://.

Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
    If Request.IsSecureConnection = False And _
        Not Request.Url.Host.Contains("localhost") Then

        Response.Redirect(Request.Url.AbsoluteUri.Replace("http://", "https://"))
    End If
End Sub

This may be easier to implement on a master page or just all the pages you require https. By checking for "localhost" you will avoid getting an error in your testing environment (Unless your test server has another name than check for that: "mytestservername").

Jeff O
i don't know how to redirect login page with HTTPS:// that is my problem. thanks
Mon Aung
Add Guiness' code to the page that contains your login control. I'd probably actually move it to the top of page_load, or into OnInit, as that saves processing everything else, but this will work nicely.
Zhaph - Ben Duguid