简体   繁体   English

asp.net网站

[英]asp.net website

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. 我正在使用ASP.NET向导。 I have this page - checkout.aspx, and this control checkout.ascx contained by the page. 我有此页面-checkout.aspx,并且该页面包含此控件checkout.ascx。 Now, the encode to ensure ssl is inside the page like this: 现在,编码以确保ssl在页面内,如下所示:

  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. 该向导位于checkout.ascx控件内。 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. 现在,它使用回发进行下​​一步,但是回发到一个不安全的页面(这意味着它从https删除“ s”),这将击中我的suresslenabled代码,并再次将自身重定向到结帐页面。

Perhaps find any instances of hardcoded http: in the related code. 也许可以在相关代码中找到任何硬编码的http:实例。 Usually a postback will respect the protocol being used. 通常,回发将遵守所使用的协议。

If the user is not logged in, he will be redirected to an unsecured page like login/register page. 如果用户未登录,他将被重定向到一个不安全的页面,如登录/注册页面。 Make your question more clear. 让您的问题更清楚。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM