views:

897

answers:

2

I am having a website (developed in ASP.NET 2.0 (C#)) registered with godaddy.com But when I am adding HttpModule in my web.config as follow:

<httpModules>
  <add type="WwwSubDomainModule" name="WwwSubDomainModule" />
</httpModules>

but it gives me "500 Internal Server Error". When I removed the above tag then my website is working fine. Can anyone guess why its creating this problem??

+1  A: 

What is WwwSubDomainModule? I strongly suspect you need to specify the namespace and possibly the assembly name. If you turn verbose error logging on, it should give you more information too.

Jon Skeet
I used the method given here: http://blog.madskristensen.dk/post/Add-or-remove-the-www-sub-domain.aspx
Prashant
That contains a type which isn't in a namespace. Is it still not in a namespace in your own code? (That doesn't sound like a great idea, to be honest. I'd put it in a namespace and put the fully-qualified name in web.config.)
Jon Skeet
Ok, just wait let me check it.... I am putting that class in the namespace.
Prashant
Right. Specify the namespace in the type="..." bit and you may well find it just starts magically working :)
Jon Skeet
Nope, its not working, I have added "<add type="commonClasses.WwwSubDomainModule" name="WwwSubDomainModule" />"
Prashant
I created a namespace "commonClasses" and added the same in we.config but its giving me the same error. The error page is predefined by godaddy, so its not displaying me any error it just displaying that predefined 500 error page :(
Prashant
Hey @Jon checkout my answer, I got the solution how to solve this problem :)
Prashant
Well, you've given *a* solution, but I'm pretty sure just fully qualifying the type name would have worked in the first place. I also *strongly* recommend that you debug locally as far as possible, rather than deploying to godaddy and *then* trying to debug.
Jon Skeet
+1  A: 

Got it guys :)

I was facing this problem since last October 2008, but finally I got this why? Instead of adding modules like I have added above in my question, use the following new module syntax made for IIS7 (godaddy is using IIS7 for windows hosting)

<configuration>
   <system.webServer>
      <modules>
         <add name="Header" type="Contoso.ShoppingCart.Header"/>
      </modules>
   </system.webServer>
</configuration>

Place all your modules under here and you're done! It's nice and works perfect!

And "@Jon Skeet" there is no need to have namespace for modules, even without namespace you can get it work!

Do read more about this tag here http://www.iis.net/ConfigReference/system.webServer/modules

Prashant
Um, you've just specified a namespace there (Contoso.ShoppingCart). You don't *have* to use a namespace, but if there's a namespace in your code you've got to specify it in the type attribute...
Jon Skeet
yups that's true, if we have namespace then it should be specified :)
Prashant