【问题标题】:Asp.net https allow only payment pageAsp.net https 只允许支付页面
【发布时间】:2014-05-30 12:27:04
【问题描述】:

我知道一些 asp.net http 块技术。我有付款页面Payment.aspx。我只想应用 https 这个页面其他页面将使用 http 但 Payment.aspx 将使用 https。

    pageName = Request.Url.AbsoluteUri;
    if (pageName == "http://?????.com/Payment.aspx")
    {
        Response.Redirect("https://?.com/Payment.aspx");
    }

由于我的服务器提供商,此技术不起作用。等待您的建议。谢谢。

【问题讨论】:

    标签: c# asp.net https


    【解决方案1】:
    if(!Request.IsSecureConnection)
    {
        //perform your redirect here.
    }
    

    使用 Request.IsSecureConnection 来检测是否正在使用 HTTPS。不要试图识别魔术字符串。

    【讨论】:

    • 我添加了此代码,但if (!Request.IsSecureConnection) { Label1.Text = "Not Secure"; } else { Label1.Text = "SSL CARE"; } 当我进入 https 页面时写入不安全。我的 ssl 不工作或者页面加载中添加了这个代码错误的地方?
    【解决方案2】:

    你必须为它做一些 SSL 更改,你可以使用上面提到的链接

    Click here

    【讨论】:

    • 当我使用 https https://sophsis.com/OdemeYap.aspx 输入网址时,我有一个 ssl,我可以输入,但如果我再次输入这样的网址 http://sophsis.com/OdemeYap.aspx,我可以在没有 ssl 的情况下加入。我只想阻止 http 这个页面
    猜你喜欢
    • 2011-12-14
    • 1970-01-01
    • 2011-07-31
    • 2016-08-13
    • 1970-01-01
    • 2011-06-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多