How to Switch HtmlTextWriter via browserCaps in web.config

G

Guest

Hi,

I want my ASP.NET web application to use a custom HtmlTextWriter. i.e. I
want the object that the Framework passes to System.Web.UI.Control.Render()
to be my own object, MyHtmlTextWriter, which inherits from
System.Web.UI.HtmlTextWriter.

I have tried to do this by changing my application's web.config file: I've
added the following to the /configuration/system.web section.

<browserCaps>
tagwriter=MyNamespace.MyHtmlTextWriter
</browserCaps>

But I now get the following server error.

[ConfigurationException: The HttpBrowserCapabilities string 'tagwriter'
evaluated to 'MyNamespace.MyHtmlTextWriter'. Could not load type
MyNamespace.MyHtmlTextWriter from assembly System.Web, Version=1.0.5000.0,
Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Check the browserCaps
section of machine.config or web.config to correct the error.]

How can I tell the Framework which assembly it needs to look in to find
MyHtmlTextWriter? And does this assembly have to be in the GAC? - I'd rather
it wasn't.

Thanks,
- Lee
 
S

Steven Cheng[MSFT]

Hi Lee,

Welcome to ASPNET newsgroup.
Regarding on problem when overriding the "tagWriter" fo the <browserCaps>
setting, I think it's due to the tagWriter attribute is generally only
provided with a Type Name , no assembly info which cause the runtime
looking for the type in the System.Web.Dll. Based on my test, we can use
the assembly Full Qualified name to specify the tagWriter in <browserCaps>
like:

<browserCaps>

tagWriter=WebTagWriters.DummyWriter,WebTagWriters,Version=1.0.2057.23025,Cul
ture=neutral,PublicKeyToken=2ee82f19289eada7
</browserCaps>

the WebTagWriters.DummyWriter type is in the WebTagWriters.dll assembly.
Also, should strong named the assembly and put it into the GAC.

In addition, based on my research, the currently version of the ASP.NET
(1.x) haven't definite document on customzing the HtmlTextWriter, it is
recommend that we use the buildin ones (HtmlTextWriter or
Html32TextWriter). At lease make sure not to modify the machine.config for
such setting.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)










--------------------
| Thread-Topic: How to Switch HtmlTextWriter via browserCaps in web.config
| thread-index: AcWj8dnR3tm5I45ZT6ucpiHt2R90fw==
| X-WBNR-Posting-Host: 194.200.242.250
| From: "=?Utf-8?B?TGVlIENoYXBtYW4=?=" <[email protected]>
| Subject: How to Switch HtmlTextWriter via browserCaps in web.config
| Date: Thu, 18 Aug 2005 05:39:18 -0700
| Lines: 29
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:118849
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Hi,
|
| I want my ASP.NET web application to use a custom HtmlTextWriter. i.e. I
| want the object that the Framework passes to
System.Web.UI.Control.Render()
| to be my own object, MyHtmlTextWriter, which inherits from
| System.Web.UI.HtmlTextWriter.
|
| I have tried to do this by changing my application's web.config file:
I've
| added the following to the /configuration/system.web section.
|
| <browserCaps>
| tagwriter=MyNamespace.MyHtmlTextWriter
| </browserCaps>
|
| But I now get the following server error.
|
| [ConfigurationException: The HttpBrowserCapabilities string 'tagwriter'
| evaluated to 'MyNamespace.MyHtmlTextWriter'. Could not load type
| MyNamespace.MyHtmlTextWriter from assembly System.Web,
Version=1.0.5000.0,
| Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Check the browserCaps
| section of machine.config or web.config to correct the error.]
|
| How can I tell the Framework which assembly it needs to look in to find
| MyHtmlTextWriter? And does this assembly have to be in the GAC? - I'd
rather
| it wasn't.
|
| Thanks,
| - Lee
|
|
 
G

Guest

Thanks - that did it.

(Although I mistyped "neutral" as "netural" in my config file, which stumped
me for a bit... Doh.)

Steven Cheng said:
Hi Lee,

Welcome to ASPNET newsgroup.
Regarding on problem when overriding the "tagWriter" fo the <browserCaps>
setting, I think it's due to the tagWriter attribute is generally only
provided with a Type Name , no assembly info which cause the runtime
looking for the type in the System.Web.Dll. Based on my test, we can use
the assembly Full Qualified name to specify the tagWriter in <browserCaps>
like:

<browserCaps>

tagWriter=WebTagWriters.DummyWriter,WebTagWriters,Version=1.0.2057.23025,Cul
ture=neutral,PublicKeyToken=2ee82f19289eada7
</browserCaps>

the WebTagWriters.DummyWriter type is in the WebTagWriters.dll assembly.
Also, should strong named the assembly and put it into the GAC.

In addition, based on my research, the currently version of the ASP.NET
(1.x) haven't definite document on customzing the HtmlTextWriter, it is
recommend that we use the buildin ones (HtmlTextWriter or
Html32TextWriter). At lease make sure not to modify the machine.config for
such setting.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)










--------------------
| Thread-Topic: How to Switch HtmlTextWriter via browserCaps in web.config
| thread-index: AcWj8dnR3tm5I45ZT6ucpiHt2R90fw==
| X-WBNR-Posting-Host: 194.200.242.250
| From: "=?Utf-8?B?TGVlIENoYXBtYW4=?=" <[email protected]>
| Subject: How to Switch HtmlTextWriter via browserCaps in web.config
| Date: Thu, 18 Aug 2005 05:39:18 -0700
| Lines: 29
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:118849
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Hi,
|
| I want my ASP.NET web application to use a custom HtmlTextWriter. i.e. I
| want the object that the Framework passes to
System.Web.UI.Control.Render()
| to be my own object, MyHtmlTextWriter, which inherits from
| System.Web.UI.HtmlTextWriter.
|
| I have tried to do this by changing my application's web.config file:
I've
| added the following to the /configuration/system.web section.
|
| <browserCaps>
| tagwriter=MyNamespace.MyHtmlTextWriter
| </browserCaps>
|
| But I now get the following server error.
|
| [ConfigurationException: The HttpBrowserCapabilities string 'tagwriter'
| evaluated to 'MyNamespace.MyHtmlTextWriter'. Could not load type
| MyNamespace.MyHtmlTextWriter from assembly System.Web,
Version=1.0.5000.0,
| Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Check the browserCaps
| section of machine.config or web.config to correct the error.]
|
| How can I tell the Framework which assembly it needs to look in to find
| MyHtmlTextWriter? And does this assembly have to be in the GAC? - I'd
rather
| it wasn't.
|
| Thanks,
| - Lee
|
|
 
S

Steven Cheng[MSFT]

You're welcome Lee,

Thanks again for your posting.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
--------------------
| Thread-Topic: How to Switch HtmlTextWriter via browserCaps in web.config
| thread-index: AcWn6rdx87ybMs6vS2C2/8z1U7d9WQ==
| X-WBNR-Posting-Host: 194.200.242.250
| From: "=?Utf-8?B?TGVlIENoYXBtYW4=?=" <[email protected]>
| References: <[email protected]>
<[email protected]>
| Subject: RE: How to Switch HtmlTextWriter via browserCaps in web.config
| Date: Tue, 23 Aug 2005 06:58:19 -0700
| Lines: 112
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.dotnet.framework.aspnet:119721
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
|
| Thanks - that did it.
|
| (Although I mistyped "neutral" as "netural" in my config file, which
stumped
| me for a bit... Doh.)
|
| "Steven Cheng[MSFT]" wrote:
|
| > Hi Lee,
| >
| > Welcome to ASPNET newsgroup.
| > Regarding on problem when overriding the "tagWriter" fo the
<browserCaps>
| > setting, I think it's due to the tagWriter attribute is generally only
| > provided with a Type Name , no assembly info which cause the runtime
| > looking for the type in the System.Web.Dll. Based on my test, we can
use
| > the assembly Full Qualified name to specify the tagWriter in
<browserCaps>
| > like:
| >
| > <browserCaps>
| >
| >
tagWriter=WebTagWriters.DummyWriter,WebTagWriters,Version=1.0.2057.23025,Cul
| > ture=neutral,PublicKeyToken=2ee82f19289eada7
| > </browserCaps>
| >
| > the WebTagWriters.DummyWriter type is in the WebTagWriters.dll
assembly.
| > Also, should strong named the assembly and put it into the GAC.
| >
| > In addition, based on my research, the currently version of the ASP.NET
| > (1.x) haven't definite document on customzing the HtmlTextWriter, it is
| > recommend that we use the buildin ones (HtmlTextWriter or
| > Html32TextWriter). At lease make sure not to modify the machine.config
for
| > such setting.
| >
| > Thanks,
| >
| > Steven Cheng
| > Microsoft Online Support
| >
| > Get Secure! www.microsoft.com/security
| > (This posting is provided "AS IS", with no warranties, and confers no
| > rights.)
| >
| >
| >
| >
| >
| >
| >
| >
| >
| >
| > --------------------
| > | Thread-Topic: How to Switch HtmlTextWriter via browserCaps in
web.config
| > | thread-index: AcWj8dnR3tm5I45ZT6ucpiHt2R90fw==
| > | X-WBNR-Posting-Host: 194.200.242.250
| > | From: "=?Utf-8?B?TGVlIENoYXBtYW4=?=" <[email protected]>
| > | Subject: How to Switch HtmlTextWriter via browserCaps in web.config
| > | Date: Thu, 18 Aug 2005 05:39:18 -0700
| > | Lines: 29
| > | Message-ID: <[email protected]>
| > | MIME-Version: 1.0
| > | Content-Type: text/plain;
| > | charset="Utf-8"
| > | Content-Transfer-Encoding: 7bit
| > | X-Newsreader: Microsoft CDO for Windows 2000
| > | Content-Class: urn:content-classes:message
| > | Importance: normal
| > | Priority: normal
| > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| > | Newsgroups: microsoft.public.dotnet.framework.aspnet
| > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| > | Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA02.phx.gbl!TK2MSFTNGXA03.phx.gbl
| > | Xref: TK2MSFTNGXA01.phx.gbl
| > microsoft.public.dotnet.framework.aspnet:118849
| > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
| > |
| > | Hi,
| > |
| > | I want my ASP.NET web application to use a custom HtmlTextWriter.
i.e. I
| > | want the object that the Framework passes to
| > System.Web.UI.Control.Render()
| > | to be my own object, MyHtmlTextWriter, which inherits from
| > | System.Web.UI.HtmlTextWriter.
| > |
| > | I have tried to do this by changing my application's web.config file:
| > I've
| > | added the following to the /configuration/system.web section.
| > |
| > | <browserCaps>
| > | tagwriter=MyNamespace.MyHtmlTextWriter
| > | </browserCaps>
| > |
| > | But I now get the following server error.
| > |
| > | [ConfigurationException: The HttpBrowserCapabilities string
'tagwriter'
| > | evaluated to 'MyNamespace.MyHtmlTextWriter'. Could not load type
| > | MyNamespace.MyHtmlTextWriter from assembly System.Web,
| > Version=1.0.5000.0,
| > | Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. Check the
browserCaps
| > | section of machine.config or web.config to correct the error.]
| > |
| > | How can I tell the Framework which assembly it needs to look in to
find
| > | MyHtmlTextWriter? And does this assembly have to be in the GAC? - I'd
| > rather
| > | it wasn't.
| > |
| > | Thanks,
| > | - Lee
| > |
| > |
| >
| >
|
 

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

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top