Pronunciation / adjective
Bringing something good and unforseen.
    Skip Navigation Links > Code Repository

Redirect from https secure page to http non-secure page without a warning


Redirect from https secure page to http non-secure page without a warning

Want to stop this annoying warning?

You are about to be redirected to a connection that is not secure.
The information you are sending to the current site might be retransmitted to a nonsecure site. Do you wish to continue?

This warning occurrs when a form is submitted and the page submitted to redirects to a non-secure page. To work around the warning first redirect to a "blank" secure page with a javascript redirect tag on it. Then use the javascript to move the user to the non-secure page.

You should also include a link to the intended target page in case a user's browser doesn't support javascript.

Create a transfer page (I'll use transfer.aspx)

On the transfer page make the body tag into a server side control so that an onload javascript may be attached.
  1. <body id="Body" runat="server">
  2. <!-- Include a hyperlink to redirect the user if their browser doesn't support javascript. -->
  3. <form id="Form2" method="post" runat="server">
  4. <asp:hyperlink id="ContinueHyperLink" runat="server">Continue</asp:hyperlink>
  5. </form>
  6. </body>

In the code behind page set the body tag's and hyperlink's redirect urls. (There are many ways to pass the transfer page the uri to transfer to. For simplicity's sake I'm just going to use the querystring.)
  1. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  2. Body.Attributes.Add("onLoad", "javascript:window.location='" & Request.QueryString(Uri).toString & "'")
  3. ContinueHyperLink.NavigateUrl = Request.QueryString(Uri).toString
  4. End Sub

Microsoft Certified Professional   © 2018 Fortunate.  All rights reserved.