Registers a Web service for use in a Web page.
The proxy objects will be used to do the following:
Initialize instances of proxies of server data types, in particular for use as input parameters for invoking Web methods.
The ServiceReference control can only be used for services in the same domain.
You can define the Web service location declaratively by adding an <asp:ServiceReference> element to the <Services> element inside the <asp:ScriptManager> element on the page, and then setting its Path attribute, as shown in the following example.
<asp:ScriptManager runat="server" ID="scriptManager">
<asp:ServiceReference Path="~/WebServices/SimpleWebService.asmx" />
You might use the InlineScript property to indicate whether the proxy generation script is included in the page as an inline script block or is obtained by a separate request.
You can also programmatically add a ServiceReference object through the ScriptManager.Services or ScriptManagerProxy.Services collection by using the Add(Q) method of the ServiceReferenceCollection class.
The following example demonstrates how to add a reference to a Web service in the page markup to call the Web service methods from script.
for operating in a hosted environment. Demand value: LinkDemand. Associated enumeration: Minimal.
for operating in a hosted environment. Demand value: InheritanceDemand. Associated enumeration: Minimal.
Assembly: System.Web.Extensions (Module: System.Web.Extensions)