Home » Programming / Coding

the type or namespace name ‘webmethod’ could not be found

18 September 2009 1,004 views No Comment

If you are adding Page Method on your ASP .Net page and you see this compile error:

the type or namespace name ‘webmethod’ could not be found….

then you are missing one of these things:

A. Make sure you have reference to System.Web.Services on your class.

using System.Web.Services;

B. Make sure on your web.config you have

<system.web>
<httpModules>
<add name=”ScriptModule” type=”System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″/>
</httpModules>
</system.web>

C. Make sure you have EnablePageMethods set to true on your ScriptManager

<asp:ScriptManager ID=”ScriptManager1″ EnablePageMethods=”true” runat=”server”>
</asp:ScriptManager>

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.