0

I'm trying to add a custom HTTP Validator as shown here. I want many sites to share this implementation as an external library. That way as I discover newer/better ways to handle validation, I can update the linked assembly and update all related projects.

When I take my class and place it in my web project, all I have to do is add this line and everything works:

<system.web>
   <httpRuntime requestValidationType="SampleRequestValidator"/>

However... when I try to reference an external assembly, IIS complains saying that it can't load the type.

Question
Can someone tell me if I need to add my custom type to this section of web.config:

Line 28:        <compilation debug="false">
Line 29:                <assemblies>
Line 30:                        <add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
Line 31:                        <add assembly="System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>

Question2

Can someone tell me the correct way to get the type string to enter? So far I'm using this

Console.Writeline(typeof(SampleRequestValidator).AssemblyQualifiedName)
ohmantics
  • 1,799
  • 14
  • 16
TLDR
  • 1,198
  • 1
  • 12
  • 31

1 Answers1

1

"Yes" for question one. On my ASP.NET MVC application I also had to add my namespace to web.config:

<pages>
  <namespaces>
    <add namespace="System.Web.Mvc" />
    <add namespace="System.Web.Mvc.Ajax" />
    <add namespace="System.Web.Mvc.Html" />
    <add namespace="System.Web.Routing" />
    <add namespace="My.Custom.Namespace"/>
  </namespaces>
</pages>

What you're doing for question 2 should work... you can also see the assembly name in Visual Studio by right-clicking on the project and going to properties and then looking at the "Application" tab.

NateTheGreat
  • 2,295
  • 13
  • 9
  • Thanks.. the link you had in Revision 0 was good too.. I'll post here: http://msdn.microsoft.com/en-us/library/yfsftwz6(v=VS.100).aspx – TLDR Apr 15 '11 at 17:32