Redirect Loop?

Discussion in 'ASP General' started by Alan Moseley, Oct 19, 2009.

  1. Alan Moseley

    Alan Moseley Guest

    Please can someone put me out of my misery. I am used a shared hosting
    provider to host my asp website. I need certain pages of my site to be
    viewed over SSL. I have therefore inserted the following code into the
    Page_Load event of a page that needs to be viewed over SSL:-

    Dim strURL As String = ""
    If Not Request.IsSecureConnection Then
    strURL = Request.Url.AbsoluteUri.Replace("http://", "https://")
    Response.Redirect(strURL, True)
    End If

    On IE the page never loads, and on Firefox I get a message stating that the
    redirection limit has been exceeded.

    Have I inadvertently caused a loop, and if so, why? Many thanks in advance.
     
    Alan Moseley, Oct 19, 2009
    #1
    1. Advertisements

  2. Alan Moseley

    Dooza Guest

    I use this:

    <%
    If Request.ServerVariables("HTTPS") = "off" Then
    Response.Redirect "https://" & Request.ServerVariables("HTTP_HOST") &
    Request.ServerVariables("URL") & "?" &
    Request.ServerVariables("QUERY_STRING")
    End If
    %>

    Dooza
     
    Dooza, Oct 19, 2009
    #2
    1. Advertisements

  3. Alan Moseley

    Evertjan. Guest

    Dooza wrote on 19 okt 2009 in microsoft.public.inetserver.asp.general:

    "As" is not ASP vbscript!

    Request.IsSecureConnection is not classic ASP, I think.

    This some kind of Javascriptlike VBscript, perhaps asp.net?

    calssic ASP-vbscript:

    strURL = Replace(strURL,"http://", "https://")

    Response.Redirect has only one parameter.
    <http://msdn.microsoft.com/en-us/library/ms524309.aspx>

    And even if it had two,
    using () around them would result in an error,
    as ASP statements [and functions used as statements] do not use them.

    Strange, but you are mixing serverside and clientside terminology.

    Better show your errors, to see if they are serverside or browser errors.

    Why a loop?
    That is classic ASP VBS!
     
    Evertjan., Oct 19, 2009
    #3
  4. Alan Moseley

    Bob Barrows Guest

    As noted by Evertjian, this does not appear to be classic ASP vbscript
    code, so:

    There was no way for you to know it (except maybe by browsing through
    some of the previous questions before posting yours - always a
    recommended practice), but this is a classic (COM-based) asp newsgroup.
    ASP.Net is a different technology from classic ASP. While you may be
    lucky enough to find a dotnet-savvy person here who can answer your
    question, you can eliminate the luck factor by posting your question to
    a newsgroup where the dotnet-savvy people hang out. I suggest

    microsoft.public.dotnet.framework.aspnet.

    There are also forums at www.asp.net where you can find a lot of people
    to help you.
     
    Bob Barrows, Oct 19, 2009
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.