Custom File Extensions for ASP.NET - Need Help!

I have modaspdotnet running on my Apache 2.2 server, and as such, it performs pretty well on ASP.NET and MySQL.

However, what I would like to do is deliver content to other extensions than just the default .aspx, for example. myfile.customextension.

In Apache, I believe this is done through .htaccess, but in ASP.NET this is done through web.config.

This is my web.config file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.web>
  </system.web>
    <system.webServer>
        <staticContent>
            <mimeMap fileExtension=".testing1" mimeType="application/x-asp-net " />
        </staticContent>
    </system.webServer>

</configuration>

This works, but ASP.NET code does not display properly - and I want to be able to run ASP.NET code with any custom extension.

Installed IIS and NET 3.5.

I do not want to start a full IIS server, but I need ASP.NET for the project that I am doing, therefore, adding modaspdotnet for Apache.

httpd.conf, modaspdotnet:

    LoadModule aspdotnet_module modules/mod_aspdotnet.so

# Use the asp.net handler for all common ASP.NET file types
AddHandler asp.net asax ascx ashx asmx aspx axd config cs csproj \
                   licx rem resources resx soap vb vbproj vsdisco webinfo 
<IfModule mod_aspdotnet.cpp> 
  # For all virtual ASP.NET webs, we need the aspnet_client files
  # to serve the client-side helper scripts.
  AliasMatch /aspnet_client/system_web/(\d+)_(\d+)_(\d+)_(\d+)/(.*) "C:/Windows/Microsoft.NET/Framework/v$1.$2.$3/ASP.NETClientFiles/$4"
  <Directory "C:/Windows/Microsoft.NET/Framework/v*/ASP.NETClientFiles">
    Options FollowSymlinks
    Order allow,deny
    Allow from all
  </Directory>
</IfModule>
#asp.net 
AddType application/x-asp-net .asp
AddType text/html .asp
AddHandler application/x-httpd-php .asp

, , ? , ... - ?

+2
1

mime - , . . , aspx, , :

  • aspx httphandler :
 <httpHandlers>
...
<add verb="*" path="*.mycustomextension"> type="System.Web.UI.PageHandlerFactory"/>
  • :
<compilation >
      <buildProviders>
          <add extension=".mycustomextension" type="System.Web.Compilation.PageBuildProvider" /> 
      </buildProviders>

, ,

0

All Articles