asp.net 2.0 - build provider for aspx?

  • Thread starter Christopher Baldwin
  • Start date
C

Christopher Baldwin

Hello,

Using ASP.NET v2.0.40607.42, I'm attempting to create a new file
extension that should be handled exactly like "aspx" pages. For
example, I just want to rename an aspx page from "test.aspx" to
"test.extx", where .extx extensions are handled in exactly the same way
as aspx pages.

In pre-2.0 versions of ASP.NET, simply adding a HttpHandler element
(below) to web.config, and adding a IIS mapping of "extx" to
aspnet_isapi.dll was sufficient:

<httpHandlers>
<add verb="*" path="*.extx" type="System.Web.UI.PageHandlerFactory"/>
</httpHandlers>

Now, in 2.0 I get this error:

There is no build provider registered for the extension '.extx'. You
can register one in the <compilation><buildProviders> section in
machine.config or web.config. Make sure the appliesTo attribute
includes the value 'Web' or 'All'.

I cannot find any good reference about build providers. I don't think
I should have to write a custom build provider because I want the page
to use whatever standard aspx pages use. What is the default build
provider class used for aspx pages?
Any advice will be greatly appreciated!

Best,
chris
 
S

Scott Allen

I believe the config would look something like this for 2.0:

<buildProviders>
<add extension=".extx" appliesTo="" type="System.Web.UI.PageHandlerFactory"
/>
</buildProviders>

Although I'm not 100% about the appliesTo attribute.
 
C

Curt_C [MVP]

<buildProviders>
<add
extension="String"
appliesTo="String"
type="String" />
</buildProviders>

extension is the File Extension
appliesTo is the Directory where the file resides
type is the Type Name of the build provieder class used to invoke the
compliation

This is an exert from:
"A First Look at ASP.NET v. 2.0" (Homer/Sussman/Howard) (Addison Wesley).
Pg 431-432

There is an update, newer version, of this book as well... go get it.
I suggest this to ALL who are working with 2.0
 
J

Juan T. Llibre

Chris,

What you want to do ( process a custom file extension ) is
poorly documented in the ASP.NET 2.0 beta documentation,
but fairly easy to do.

Here's what you need to do :

Open the Internet Services Manager.


If your folder isn't configured as an Application,
configure it as an Application before proceeding.

1. Right-click the virtual folder that contains
your ASP.NET application, and then click Properties.

2. Click the Configuration button.

3. Highlight and Click the .aspx application mapping, and then click Edit.

4. Select the text in the Executable text box,
and then press CTRL+C to copy the text to your clipboard.
Click Cancel to return to the Application Configuration dialog box.

5. Click the "Add" button, paste the clipboard text into the "Executable" textbox,
and write in the file extension you want ( chris, for example - don't include the dot)

6. In the Verbs section, click to select Limit To, and then copy and paste "GET, HEAD, POST, DEBUG"
( without the quotes ) in the text box.

Click OK 3 times to get out of the Application Properties.

Now, here's a sample web.config to enable the .chris extension :

web.config :
------------
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<httpHandlers>
<add verb="GET, HEAD, POST, DEBUG" path="*.chris" type="System.Web.UI.PageHandlerFactory"/>
</httpHandlers>
<compilation>
<buildProviders>
<add extension=".chris" appliesTo="Web" type="System.Web.Compilation.PageBuildProvider" />
</buildProviders>
</compilation>
</system.web>
</configuration>
-----------------


That's it!

You can now access pages with the .chris extension,
and they will be processed just like .aspx pages are processed.

Easy, isn't it ?

Let us know how you do.



Juan T. Llibre
ASP.NET MVP
===========
Christopher Baldwin said:
Hello,

Using ASP.NET v2.0.40607.42, I'm attempting to create a new file
extension that should be handled exactly like "aspx" pages. For
example, I just want to rename an aspx page from "test.aspx" to
"test.extx", where .extx extensions are handled in exactly the same way
as aspx pages.

In pre-2.0 versions of ASP.NET, simply adding a HttpHandler element
(below) to web.config, and adding a IIS mapping of "extx" to
aspnet_isapi.dll was sufficient:

<httpHandlers>
<add verb="*" path="*.extx" type="System.Web.UI.PageHandlerFactory"/>
</httpHandlers>

Now, in 2.0 I get this error:

There is no build provider registered for the extension '.extx'. You
can register one in the <compilation><buildProviders> section in
machine.config or web.config. Make sure the appliesTo attribute
includes the value 'Web' or 'All'.

I cannot find any good reference about build providers. I don't think
I should have to write a custom build provider because I want the page
to use whatever standard aspx pages use. What is the default build
provider class used for aspx pages?
Any advice will be greatly appreciated!

Best,
chris
4
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,813
Latest member
lawrwtwinkle111

Latest Threads

Top