https and http issues ...

Posted on 2006-04-06
Last Modified: 2012-08-13
an ssl certifiacte was installed and I would like to add a fucntionalit which will detect whether or not person is coming from HTTP or HTTPS and if a person is accessing a login URL by typing in HTTP it should redirect him to HTTPS version. Please take a look at the below code. It seems that this code executes all the time and it doesn't get to other parts of the code. I added Response.Write at the bottom for testing purposes and I never get to that line, code redirects to https and a loging functionality is ignored.

                        if (Page.Request.Url.Scheme.ToLower() != "https")
                              Response.Redirect("https://" + Page.Request.Url.AbsoluteUri.Substring(Page.Request.Url.AbsoluteUri.IndexOf(Page.Request.Url.Host)));

//login functionality starts here
Response.Write("Login Functionality");
Question by:TransBind
    1 Comment
    LVL 12

    Accepted Solution

    think you should remove if(Page.IsPostBack)

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now