1

i have this website, and this specific page is secure, but when it postbacks, it postbacks to an unsecure page. How to fix that?!

I am using ASP.NET Wizard. I have this page - checkout.aspx, and this control checkout.ascx contained by the page. Now, the encode to ensure ssl is inside the page like this:

  protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);
         if (!HttpContext.Current.Request.IsSecureConnection) {
                HttpContext.Current.Response.Redirect(SiteNavigation.ResolveAbsoluteUrl(true, HttpContext.Current.Request.Url.PathAndQuery));
            }

    }

The wizard is inside checkout.ascx control. Now, it uses postbacks to go to the next step, but it postbacks to an insecure page (meaning it drops "s" from https), which hits my ensuresslenabled code, and it redirects itself to the checkout page again.

9
  • The "action" attribute of your <form> tag determines this. As your title mentions asp.net, there's some magic going on probably. You will need to post a code sample to get a useful answer. Dec 8, 2009 at 18:36
  • I have provided some more detail in my question now. Please let me know if you need more details.
    – TPR
    Dec 8, 2009 at 18:40
  • Still need more info. What is going on in Utils.EnsureSSLEnabled()? Dec 8, 2009 at 18:46
  • I replaced that with the function definition itself. SiteNavigation.ResolveAbsoluteUrl(...) funciton in merely appending 's' to http, and it's not messing up the url, because I can see the right url in front of me.
    – TPR
    Dec 8, 2009 at 18:48
  • Sorry, still not enough info. Do you have any values specified for any of the *Url properties of the wizard control, or something else? Or a hard-coded action using http://? By default it will post back to the same page. Dec 8, 2009 at 18:55

2 Answers 2

1

Perhaps find any instances of hardcoded http: in the related code. Usually a postback will respect the protocol being used.

0
-1

If the user is not logged in, he will be redirected to an unsecured page like login/register page. Make your question more clear.

1
  • Question was edited after my answer. Earlier the question comprised of just one line shown above.
    – pokrate
    Dec 9, 2009 at 11:04

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.