• Use scriptmethodattribute to mark
-Set the usehttpget attribute to true.
• The client's proxy method remains unchanged
• The parameter will be passed using querystring
• The performance is slightly higher than the httppost Method
• Some features have slightly changed
-Cache Basics
Aspx < Form ID = " Form1 " Runat = " Server " >
< ASP: scriptmanager ID = " Scriptmanager1 " Runat = " Server " Scriptmode = " Debug " >
< Services >
< ASP: servicereference path = " Services/usehttpgetservice. asmx " Inlinescript = " True " />
</ Services >
</ ASP: scriptmanager >
< Input type = " Button " Value = " Get random " Onclick = " Getrandom () " />
< Input type = " Button " Value = " Get range random " Onclick = " Getrandom (1, 50,100) " />
< Script Language = " Javascript " Type = " Text/JavaScript " >
Function getrandom (minvalue, maxvalue)
{
If (Arguments. Length ! = 2 )
{
Usehttpgetservice. getrandom (onsucceeded );
}
Else
{
Usehttpgetservice. getrangerandom (minvalue, maxvalue, onsucceeded );
}
}
Function onsucceeded (result)
{
Alert (result );
}
</ Script >
</ Form >
Usehttpgetservice. asmx<%@ WebService Language="C #"Class="Usehttpgetservice" %>
UsingSystem;
UsingSystem. Web;
UsingSystem. Web. Services;
UsingSystem. Web. Services. Protocols;
UsingSystem. Web. Script. Services;
[WebService (namespace = " Http://tempuri.org/ " )]
[Webservicebinding (conformsto = Wsiprofiles. basicprofile1_1)]
[Scriptservice]
Public Class Usehttpgetservice: system. Web. Services. WebService
{
[Webmethod]
Public Int Getrandom ()
{
Return New random (datetime. Now. millisecond). Next ();
}
[webmethod]
[scriptmethod (usehttpget = true )]
Public int getrangerandom ( int minvalue, int maxvalue)
{< br> return New random (datetime. now. millisecond ). next (minvalue, maxvalue);
}< BR >}
added [scriptmethod (usehttpget = true )] indicates access using the get method.