1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Converting aspx urlinto html using java script

Discussion in 'Programming' started by seogray, Oct 23, 2009.

  1. #1
    Hello Dps,

    Please solve my query.

    I have a web page like (www.example.com/home.aspx). I want to convert that url into html url using java script. Please let me know how to make it done.

    All replies will be highly Appericiated.

    Thanks
     
    seogray, Oct 23, 2009 IP
  2. pneulameiro

    pneulameiro Peon

    Messages:
    440
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I think you can't do that with javascript. maybe with .htaccess. But let me understand it right: do you just want to display .html instead of .aspx in the url bar?
     
    pneulameiro, Oct 23, 2009 IP
  3. seogray

    seogray Peon

    Messages:
    245
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Its like i have a url that is in .aspx and i just want to convert that into .html using javascript , so i can use that for promotion....

    LET ME KNOW

     
    seogray, Oct 23, 2009 IP
  4. camjohnson95

    camjohnson95 Active Member

    Messages:
    737
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #4
    I'm not sure what you mean exactly. But if you open up the page in your browser and then save it locally as HTML, then upload that html. It will display. But that will only work if the page is static (it doesn't change according to a database etc, and has no forms etc.) If it does then there you cannot change the page to HTML, because HTML runs client-side (on the users computer) where aspx (asp.net) runs server-side (on the server). You can use .htaccess or other methods to make the page appear to be a .HTML page, but it will still be asp because it has to be in order to run the necessary code on the server, otherwise it won't display properly.
     
    camjohnson95, Oct 25, 2009 IP
  5. Gungz

    Gungz Peon

    Messages:
    65
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    As far as I know, you can't change the extension of aspx file into html like what we can do with PHP.

    So, whatever you do, the extension still will be .aspx.

    That's as far as I know. Maybe anyone can help?
     
    Gungz, Oct 25, 2009 IP
  6. Sp4rkR4t

    Sp4rkR4t Peon

    Messages:
    19
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    You cannot run asp.net code from a file with the .html extension, what you can do is put a couple of lines of code in your asp app so that to the end user it appears like to have the .html extension;

    void Application_BeginRequest(object sender, EventArgs e)
    {
        HttpApplication app = sender as HttpApplication;
        if(app.Request.Path.IndexOf("View.html") > 0)
        {
            app.Context.RewritePath("/View.aspx");
        }
    }
    Code (markup):
     
    Sp4rkR4t, Oct 25, 2009 IP