Yesterday I used the same code as below, and today the same code is not changed at all. But when I look at this program again today, it doesn't even say "the object cannot be found". Everything is normal !!!!
Is this really a matter of character in the legend ?? Depressed !!
I found that when I write a WebService file using the "Code Page placed in a file separately", it will appear ".. Not defined.
The ASPX page code is as follows:
1 <div>
2 <asp: scriptmanager id = "scriptmanager1" runat = "server">
3 <services>
4 <asp: servicereference Path = "Hello. asmx"/>
5 </services>
6 </ASP: scriptmanager>
7 </div>
8 <input id = "button1" type = "button" value = "button" Language = "JavaScript" onclick = "Return button1_onclick () "/> 1 <script language =" JavaScript "type =" text/JavaScript ">
2 <! --
3
4 function button1_onclick (){
5 hello. sayhello ('OK', onsucceed );
7}
8
9 function onsucceed (result)
10 {
11 alert (result );
12}
13
14 // -->
Hello. asmx: 1 without code separation <% @ WebService Language = "C #" class = "hello" %>
2
3 using system;
4 using system. Web;
5 using system. Web. Services;
6 using system. Web. Services. Protocols;
7 using system. Web. Script. Services;
8
9 [WebService (namespace = "http://tempuri.org/")]
10 [webservicebinding (conformsto = wsiprofiles. basicprofile1_1)]
11 [scriptservice]
12 public class Hello: system. Web. Services. WebService
13 {
14 [webmethod]
15 Public String sayhello (string name)
16 {
17 return string. Format ("WebService Hello {0}", name );
18}
19}
To separate the CS code, put it in a CS file, which is in the app_code folder.
Who can tell you that it is not possible when code separation is used ??