What is the assembly name to use for new ASHX files

  • Thread starter Philipp Schmid [MSFT]
  • Start date
P

Philipp Schmid [MSFT]

I am trying to add a Generic Handler (ASHX) to my web site solution. In
order to do that I have to specifiy an assembly name in the web.config file.
But since 2.0 web sites are no longer pre-compiled I get an error when
trying to load the first page.

<system.web>
<httpHandlers>

<add verb="GET,POST" path="*.angel" type="Namespace.MyHandler" />

</httpHandlers>

</system.web>

I get the following error:

Line 51: <system.web>
Line 52: <httpHandlers>
Line 53: <add verb="GET,POST" path="*.angel"
type="Namespace.MyHandler" />
Line 54: </httpHandlers>
Line 55: </system.web>

- Philipp
 
P

Philipp Schmid

Sorry about that:

Parser Error Message: The 'type' attribute must be set to a valid Type name
(format: <typename>[,<assemblyname>])

- Philipp
 
P

Philipp Schmid

I've also tried to create another class library (HandlerLib) project that
contains the ASHX file and then reference that assembly from my web site
project (which promptly adds HandlerLib.dll to the Bin directory). When I
then use the assembly name HandlerLib in my web.config file it still doesn't
work. Maybe I need to put it in the GAC?

- Philipp

BTW, I am using VS.NET 2005 B2 in case that makes any difference.

Philipp Schmid said:
Sorry about that:

Parser Error Message: The 'type' attribute must be set to a valid Type
name (format: <typename>[,<assemblyname>])

- Philipp

Juan T. Llibre said:
What is the error ?

You did not include it.
 
J

Juan T. Llibre

Hi, Philipp.

If all you want to do is add a specific extension
to the pages which are served by your server, use this :

<httpHandlers>
<add verb="GET, HEAD, POST, DEBUG" path="*.angel"
type="System.Web.UI.PageHandlerFactory"/>
</httpHandlers>
<compilation>
<buildProviders>
<add extension=".angel" type="System.Web.Compilation.PageBuildProvider" />
</buildProviders>
</compilation>

and map the extension .angel to aspnet_isapi.dll in the
Application's configuration section in the Internet Service Manager.

That will cause ASP.NET to process the .angel extension
in the exact same way it processes files with the .aspx extension.

That should be enough for your needs.

If it isn't, post what you want to do with your .angel extension,
that can't be done in an aspx file.

See my custom extension .juan running at : http://asp.net.do/test/version.juan





Philipp Schmid said:
I've also tried to create another class library (HandlerLib) project that contains the
ASHX file and then reference that assembly from my web site project (which promptly adds
HandlerLib.dll to the Bin directory). When I then use the assembly name HandlerLib in my
web.config file it still doesn't work. Maybe I need to put it in the GAC?

- Philipp

BTW, I am using VS.NET 2005 B2 in case that makes any difference.

Philipp Schmid said:
Sorry about that:

Parser Error Message: The 'type' attribute must be set to a valid Type name (format:
<typename>[,<assemblyname>])

- Philipp

Juan T. Llibre said:
What is the error ?

You did not include it.




I am trying to add a Generic Handler (ASHX) to my web site solution. In order to do
that I have to specifiy an assembly name in the web.config file. But since 2.0 web
sites are no longer pre-compiled I get an error when trying to load the first page.

<system.web>
<httpHandlers>

<add verb="GET,POST" path="*.angel" type="Namespace.MyHandler" />

</httpHandlers>

</system.web>

I get the following error:

Line 51: <system.web>
Line 52: <httpHandlers>
Line 53: <add verb="GET,POST" path="*.angel" type="Namespace.MyHandler"
/>
Line 54: </httpHandlers>
Line 55: </system.web>

- Philipp
 
P

Philipp Schmid

Using an ASPX page was my first attempt. However, I haven't found a way to
remove the <htm>, <head>, and <body> tags from the response that is
generated! Well, guess what - I tried again and now it works!

So my immediate problem is solved, but I still wonder how to add an ASHX
handler to a 2.0 web site. I think having an second assembly which contains
the handler code is probably correct. Now why it doesn't get loaded then
added as a reference to the project (and is put in the \bin directory) is
strange to me. Does this assembly have to be signed (but then the error
message could be improved).

- Philipp


Juan T. Llibre said:
Hi, Philipp.

If all you want to do is add a specific extension
to the pages which are served by your server, use this :

<httpHandlers>
<add verb="GET, HEAD, POST, DEBUG" path="*.angel"
type="System.Web.UI.PageHandlerFactory"/>
</httpHandlers>
<compilation>
<buildProviders>
<add extension=".angel" type="System.Web.Compilation.PageBuildProvider" />
</buildProviders>
</compilation>

and map the extension .angel to aspnet_isapi.dll in the
Application's configuration section in the Internet Service Manager.

That will cause ASP.NET to process the .angel extension
in the exact same way it processes files with the .aspx extension.

That should be enough for your needs.

If it isn't, post what you want to do with your .angel extension,
that can't be done in an aspx file.

See my custom extension .juan running at :
http://asp.net.do/test/version.juan





Philipp Schmid said:
I've also tried to create another class library (HandlerLib) project that
contains the ASHX file and then reference that assembly from my web site
project (which promptly adds HandlerLib.dll to the Bin directory). When I
then use the assembly name HandlerLib in my web.config file it still
doesn't work. Maybe I need to put it in the GAC?

- Philipp

BTW, I am using VS.NET 2005 B2 in case that makes any difference.

Philipp Schmid said:
Sorry about that:

Parser Error Message: The 'type' attribute must be set to a valid Type
name (format: <typename>[,<assemblyname>])

- Philipp

What is the error ?

You did not include it.




I am trying to add a Generic Handler (ASHX) to my web site solution. In
order to do that I have to specifiy an assembly name in the web.config
file. But since 2.0 web sites are no longer pre-compiled I get an error
when trying to load the first page.

<system.web>
<httpHandlers>

<add verb="GET,POST" path="*.angel" type="Namespace.MyHandler" />

</httpHandlers>

</system.web>

I get the following error:

Line 51: <system.web>
Line 52: <httpHandlers>
Line 53: <add verb="GET,POST" path="*.angel"
type="Namespace.MyHandler" />
Line 54: </httpHandlers>
Line 55: </system.web>

- Philipp
 
J

Juan T. Llibre

Hi, Philipp.

have you seen an article by Scott Mitchell,
titled "Serving Dynamic Content with HTTP Handlers" ?

It's at :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/httphandl.asp
and has quite extensive sample code at :
http://download.microsoft.com/downl...7-A749-FA2B5ADE70EA/MSDNHandlers.msiAnalyzing Scott's sample code might help you dissectwhy yours isn't working the way you'd like it to work.Juan T. Llibre, ASP.NET MVPASP.NET FAQ : http://asp.net.do/faq/Foros de ASP.NET en Español : http://asp.net.do/foros/======================================"Philipp Schmid" <[email protected]> wrote in messagenews:%[email protected]...> Using an ASPX page was my first attempt. However, I haven't found a way to remove the<htm>, <head>, and <body> tags from the response that is generated! Well, guess what - Itried again and now it works!>> So my immediate problem is solved, but I still wonder how to add an ASHX handler to a2.0 web site. I think having an second assembly which contains the handler code isprobably correct. Now why it doesn't get loaded then added as a reference to the project(and is put in the \bin directory) is strange to me. Does this assembly have to be signed(but then the error message could be improved).>> - Philipp>>> "Juan T. Llibre" <[email protected]> wrote in messagenews:[email protected]...>> Hi, Philipp.>>>> If all you want to do is add a specific extension>> to the pages which are served by your server, use this :>>>> <httpHandlers>>> <add verb="GET, HEAD, POST, DEBUG" path="*.angel"type="System.Web.UI.PageHandlerFactory"/>>> </httpHandlers>>> <compilation>>> <buildProviders>>> <add extension=".angel" type="System.Web.Compilation.PageBuildProvider" />>> </buildProviders>>> </compilation>>>>> and map the extension .angel to aspnet_isapi.dll in the>> Application's configuration section in the Internet Service Manager.>>>> That will cause ASP.NET to process the .angel extension>> in the exact same way it processes files with the .aspx extension.>>>> That should be enough for your needs.>>>> If it isn't, post what you want to do with your .angel extension,>> that can't be done in an aspx file.>>>> See my custom extension .juan running at : http://asp.net.do/test/version.juan>>>>>>>>>> Juan T. Llibre, ASP.NET MVP>> ASP.NET FAQ : http://asp.net.do/faq/>> Foros de ASP.NET en Español : http://asp.net.do/foros/>> ======================================>> "Philipp Schmid" <[email protected]> wrote in messagenews:[email protected]...>>> I've also tried to create another class library (HandlerLib) project that contains theASHX file and then reference that assembly from my web site project (which promptly addsHandlerLib.dll to the Bin directory). When I then use the assembly name HandlerLib in myweb.config file it still doesn't work. Maybe I need to put it in the GAC?>>>>>> - Philipp>>>>>> BTW, I am using VS.NET 2005 B2 in case that makes any difference.>>>>>> "Philipp Schmid" <[email protected]> wrote in messagenews:[email protected]...>>>> Sorry about that:>>>>>>>> Parser Error Message: The 'type' attribute must be set to a valid Type name (format:<typename>[,<assemblyname>])>>>>>>>> - Philipp>>>>>>>> "Juan T. Llibre" <[email protected]> wrote in messagenews:%23SHvCq%[email protected]...>>>>> What is the error ?>>>>>>>>>> You did not include it.>>>>>>>>>>>>>>>>>>>> Juan T. Llibre, ASP.NET MVP>>>>> ASP.NET FAQ : http://asp.net.do/faq/>>>>> Foros de ASP.NET en Español : http://asp.net.do/foros/>>>>> ======================================>>>>> "Philipp Schmid [MSFT]" <[email protected]> wrote in messageam trying to add a Generic Handler (ASHX) to my web site solution. In order to dothat I have to specifiy an assembly name in the web.config file. But since 2.0 web sitesare no longer pre-compiled I get an error when trying to load the first page.>>>>>>>>>>>> <system.web>>>>>>> <httpHandlers>>>>>>>>>>>>> <add verb="GET,POST" path="*.angel" type="Namespace.MyHandler" />>>>>>>>>>>>> </httpHandlers>>>>>>>>>>>>> </system.web>>>>>>>>>>>>> I get the following error:>>>>>>>>>>>> Line 51: <system.web>>>>>>> Line 52: <httpHandlers>>>>>>> Line 53: <add verb="GET,POST" path="*.angel" type="Namespace.MyHandler"/>>>>>>> Line 54: </httpHandlers>>>>>>> Line 55: </system.web>>>>>>>>>>>>> - Philipp>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
 

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,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top