SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    Jan 2001
    Posts
    244
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need this ASP converted to JavaScript

    Hi!
    I have this ASP code that I need to translate to JS.
    Code:
    <%
     domain = Request.ServerVariables("SERVER_NAME")
     path = Request.ServerVariables("PATH_INFO")
     Response.Redirect "https://"& domain & path &""
     %>
    Is a simple ASP that reads the server name and path info and redirects it from http to https. I know how to redirect in JS, but I'm not sure if I can retreive the server name and path. Any help would be apreciated.
    Guillermo

  2. #2
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Do you just want to reload the page? If so then this will work:
    Code:
    location.reload;

  3. #3
    SitePoint Wizard silver trophybronze trophy asp_funda's Avatar
    Join Date
    Jun 2003
    Location
    ether
    Posts
    4,497
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Nah, location.reload won't work. He said that he needs to reload the page from http:// to https://. Note the 's' in the protocol Vinnie.

    pulsorocker, do you need a code to work in client browser or use it as ASP on server side?
    If you want to use it on server side with ASP/JScript, then here's it is:
    Code:
    <%
    var domain = Request.ServerVariables("SERVER_NAME");
    var path = Request.ServerVariables("PATH_INFO");
    Response.Redirect "https://" + domain + path;
    %>
    This is the ASP code that you use if you are using JScript to code ASP, I mean if you are using
    Code:
    <% @language="JScript" %>
    or
    Code:
    <% @language="JavaScript" %>
    Our lives teach us who we are.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Me - Photo Blog - Personal Blog - Dev Blog
    iG:Syntax Hiliter -- Colourize your code in WordPress!!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •