use html extesnion instead of/with aspx extension

Last post 06-05-2009 2:34 AM by sarathrevuri. 14 replies.

Sort Posts:

  • use html extesnion instead of/with aspx extension

    02-09-2005, 5:53 AM
    • Member
      25 point Member
    • arjang
    • Member since 11-09-2002, 11:27 AM
    • Posts 5
    Hi
    I want my aspx pages to have html extensions at times.
    I looked at the source code and couldnt find what to tweak,
    So how do I get cassini to treat process html pages as if they had aspx extension.
    Kind Regards

    Arjang
  • Re: use html extesnion instead of/with aspx extension

    02-11-2005, 7:05 PM
    • Contributor
      4,570 point Contributor
    • danmor
    • Member since 11-04-2002, 9:48 PM
    • Bellevue, WA
    • Posts 910
    • AspNetTeam
    That isn't something you can change. You must rename the file to have the ASPX extension. The file extension is what tells ASP.NET to compile the page. The HTML page does not need to have ASP.NET code inside of it, simply giving it the ASPX extension will cause it to be compiled by ASP.NET.
    -Dan
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: use html extesnion instead of/with aspx extension

    02-17-2005, 7:54 PM
    • Member
      25 point Member
    • arjang
    • Member since 11-09-2002, 11:27 AM
    • Posts 5
    Thank you for your reply;

    I want asp.net to compile the pages with html extension.

    I have done similar things before with Apache and php where I was able to specify the extensions to be handled by the scripting engine.
    Surely there must be a setting somewhere that can be twicked to use any arbitrary extension to be compiled by Asp.net, unless the aspx is been hard coded into the framework!

    Regards

    Arjang
  • Re: use html extesnion instead of/with aspx extension

    02-18-2005, 2:34 PM
    • Contributor
      4,570 point Contributor
    • danmor
    • Member since 11-04-2002, 9:48 PM
    • Bellevue, WA
    • Posts 910
    • AspNetTeam
    If you run "IIS Manager", on the Home Directory tab, and click the "Configuration" button you will see what file extensions are mapped to which ISAPI's. There you will see ASPX is mapped to aspnet_isapi.dll. HTML files are not mapped to an ISAPI. IIS sends HTML directly to the client (HTML is simply a text file). HTML files do not need to be compiled because the overhead of sending them to another ISAPI would make them less performant. They are fastest served by IIS.
    -Dan
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: use html extesnion instead of/with aspx extension

    02-20-2005, 6:29 AM
    • Member
      25 point Member
    • arjang
    • Member since 11-09-2002, 11:27 AM
    • Posts 5
    Thank you danmor

    I would like to have asp code in my pages with html extension.
    I would like pages with html extension's to be processed by ASP engine.
    I have no plain html files, only pages wich have asp code scripted in them.
    How can I get cassini to parse .html files as if they were .aspx files.
    Kind Regards

    Arjang
  • Re: use html extesnion instead of/with aspx extension

    02-20-2005, 9:24 PM
    • Member
      45 point Member
    • salgravano
    • Member since 08-25-2003, 1:57 AM
    • Olympia, WA
    • Posts 9
    Cassini can not process ASP script. Cassini is built on the .NET Framework which is a separate technology than ASP (sometimes referred to as "Classic ASP"). Only IIS can host ASP pages. And the only way to tell IIS that the page contains ASP script is to set the file extension to ".asp". If the file extension is HTML it will always be served to the browser and not compiled, even if it contains script and even if the .NET framework handles it.

    If you have server-side script written for the .NET Framework it must have the ".ASPX" extension. If you name it HTML the scripts will not be compiled, and your code will be exposed to the end user. You can still use client-side JScript and VBScript in an HTML file, but your code is visible to the end user.
  • Re: use html extesnion instead of/with aspx extension

    02-21-2005, 10:04 PM
    • Member
      25 point Member
    • arjang
    • Member since 11-09-2002, 11:27 AM
    • Posts 5
    Thank you for your reply;

    To best of my knowledge, an extension is a configurable feature.
    wether a page has the aspx or html extension is totally irrelavent to
    what it contains.
    As a aspx page can be pure html so does an html page can completly contain asp .net controls and code.

    Please respond to this message if you are aware of the setting that can be configured to pass the files with extension html to be treated as if they were aspx pages.(with cassini)

    Thank you for all the previous replies.

    Kind regards

    Arjang
  • Re: use html extesnion instead of/with aspx extension

    02-22-2005, 12:51 AM
    • Contributor
      4,570 point Contributor
    • danmor
    • Member since 11-04-2002, 9:48 PM
    • Bellevue, WA
    • Posts 910
    • AspNetTeam
    Why would you want to do that? What would you gain by having server-side code in a file named HTML rather than ASPX? I don't see any gain because you could never share code with anyone. You could not move your files to another machine without your customized Cassini or customized IIS.

    I don't know how to modify the Cassini sample to do something like that, but you can customize IIS to have ASP.NET ISAPI's handle other file extensions. This article talks about how to modify IIS to prevent a specific file (MDB) from being browsed, but the idea of changing the handling of specific file extensions is the same. http://aspnet.4guysfromrolla.com/articles/020404-1.aspx
    -Dan
    This posting is provided "AS IS" with no warranties, and confers no rights.
  • Re: use html extesnion instead of/with aspx extension

    05-08-2005, 9:27 PM

    I would like to figure out how to do this, too.  I know how to do it in IIS, I just don't know how to do it in DNN.  It would have to be done in both places.  Inventua's HrefExchanger module is great for this, however, at the present moment it doesn't have the capability to change the file extension without also invoking its own friendly URL feature.  I just asked them to separate those features because the module is a great, easy way to change the .aspx file extension but there are some issues with the friendly URL's (namely some modules, such as cataLook, can't currently handle them plus if you change the page title in the future you must specify the old page in your URL rewriting rules or old bookmarks break).  I made the request on Inventua's forum, here:

    http://www.inventua.com/forums.content?forumid=1&postid=498&view=topic

    If you are still interested in this capability, please log onto the Inventua forum and encourage them as well, I've found that they are very responsive when enough users request a good enhancement.

    I plan not to investigate how to do this myself with DNN much further at this time, first I want to gauge the response from Inventua.  If they will make this enhancement quickly, I'd rather wait for them to do so.  To address the other questions on this thread about why somebody would want to change the file extension, here are my reasons:

    1.  Brand recognition.  I want to change the file extension to my company's acronym to build identity and brand recognition. 

    2.  Credibility.  I think many users and potential customers will have the perception that my company has greater credibility because of the custom file extension.

    3.  Security.  I believe that obscuring the technology one is using with web applications is one of the easiest ways to enhance security.  There's generally no easier way for somebody to determine what platform you are running on than by observing the file extension of your web app pages.  If it weren't for my other reasons, if security were my only concern I'd probably change the extension to .php or .cfm.

    4.  Search engine ranking.  I don't know how much positive impact this will have on search engine rankings, in most cases probably not much, but my file extension contains a string that is common to my target search strings.  I think it is possible that with some engines, using an unrecognized file extension could actually compromise my rankings.  I've done some research on it and didn't find anything conclusive, I'd very much like to know if anybody has insight into that question.

    Shane Miller
  • Re: use html extesnion instead of/with aspx extension

    05-14-2005, 12:00 PM
    • Contributor
      2,680 point Contributor
    • imleggy
    • Member since 05-05-2003, 2:09 PM
    • England
    • Posts 536
    Those may be good reasons to change it, but Cassini does not have the security that IIS has, and should not be used to serve a live website. You need to look into configuring IIS for this, not Cassini.
    Dave Legg
  • Re: use html extesnion instead of/with aspx extension

    05-14-2005, 12:32 PM
    You're right, my apologies...I forgot we were in the Cassini forum.
    Shane Miller
  • Re: use html extesnion instead of/with aspx extension

    07-11-2005, 10:18 AM
    • Member
      22 point Member
    • clay_mckinney
    • Member since 06-23-2005, 1:52 PM
    • Posts 7

    The reason I want to use the .html extension instead of .aspx is that the site already exists as a straight HTML web site. I want to convert all the pages to .aspx so I can use web controls for navigation, etc. But I don't want to break all the incoming links to my site. So the extensions cannot change.

  • Re: use html extesnion instead of/with aspx extension

    07-11-2005, 1:03 PM
    • Contributor
      2,680 point Contributor
    • imleggy
    • Member since 05-05-2003, 2:09 PM
    • England
    • Posts 536
    Would it not be possible to setup the site to either:
    1. map page.html to page.aspx?
    or
    2. Have a custom 404 page that detects the page the user was trying to access (page.html) checks for an equivilent page (page.aspx) and if it exists, redirect?

    Dave Legg
  • Re: use html extesnion instead of/with aspx extension

    04-15-2009, 4:12 AM
    • Member
      2 point Member
    • jack_s19822
    • Member since 04-15-2009, 8:10 AM
    • Posts 1

    This might help: nopcommerce 's  shopping cart solution about URL re-writing.

     

    changed the extention from ASPX to HTM or HTML. see link below

     

    http://forums.nopcommerce.com/forums/default.aspx?g=posts&m=1697&#1697

    Filed under:
  • Re: use html extesnion instead of/with aspx extension

    06-05-2009, 2:34 AM
    • Member
      2 point Member
    • sarathrevuri
    • Member since 08-09-2007, 5:20 AM
    • Posts 1

    The code specified below will be helpful to have the extension as  html insted of aspx for the end user.

     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");
        }
    }

Page 1 of 1 (15 items)