400 Bad request - REST JSON c# - c#

I've created a C# WCF project, when I'm testing it using POSTMAN or Fiddler. I've received an error: "400 Bad Request". Also I've created an C# windows project to test, it is the same result as well. Here's my WCF Project.
[ServiceContract]
public interface IService1
{
[OperationContract]
[WebInvoke(Method = "POST",
ResponseFormat = WebMessageFormat.Json,
RequestFormat = WebMessageFormat.Json,
BodyStyle = WebMessageBodyStyle.Wrapped,
UriTemplate = "api/createpr.json")]
PRApplication AddPR(RequestData rData);
}
I'm using this code when testing.
try
{
var httpWebRequest = (HttpWebRequest)WebRequest.Create("http://localhost/WEB_Service_B1/Service1.svc/api/createpr.json");
httpWebRequest.ContentType = "application/json; charset=utf-8";
httpWebRequest.Method = "POST";
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
string json = "{\"Test\"}";
streamWriter.Write(json);
streamWriter.Flush();
streamWriter.Close();
}
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var result = streamReader.ReadToEnd();
}
}
catch (Exception err)
{
MessageBox.Show(err.Message);
}
Is there any problem also in my Web.config?
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Windows" />
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
</system.web>
<system.webServer>
<directoryBrowse enabled="true"/>
</system.webServer>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="WS_B1.Service1Behavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="web">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="WS_B1.Service1" behaviorConfiguration="WS_B1.Service1Behavior">
<endpoint address="" binding="webHttpBinding" contract="WS_B1.IService1" behaviorConfiguration="web">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
</system.serviceModel>
</configuration>

BodyStyle = WebMessageBodyStyle.Wrapped
This means the request needs to be a full json object. Try with the following request body:
string json = "{\"rData\": {\"PropertyName\": \"Test\"}}";
Where PropertyName is a public property of RequestData class of string type.

Related

How can I call a Code Behind method with JavaScript?

I want to call a Code Behind method with JS. I already tried [WebMethod]. I referred this link. But my code behind is not getting called. I pasted code below so you can find out actual problem for that.
Javascript
<script type="text/javascript">
function sendMail()
{
var arr = [];
arr.push('foo');
arr.push('bar');
arr.push('bazz');
$.ajax({
type: "POST",
url: "~/Modules/Masters/Email.aspx/SendMail",
data: "{info:arr}", // passing the parameter
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (retValue) {
// Do something with the return value from.Net method
}
});
}
</script>
Code Behind
[WebMethod]
public static string SendMail(string[] info)
{
return "";
}
Does it need any library. I already have
<script src="/js/jquery-1.9.1.js" type="text/javascript"></script> in my .Master file.
try removing the "~" from the url in your ajax call. I don't think javascript can handle it well.
There is a few things that can be wrong, firstly you will need a ScriptManager on your page too!
i am sending mail from pure html page using wcf service may be useful to you please chk this code:
html page:
$(document).ready(function () {
$('#reqinfo').click(function () {
// debugger;
var emailto = document.getElementById("emailid").value;
if (emailto != "") {
$.ajax({
type: "GET",
url: "/EmailService1.svc/EmailService1/emaildata?Email=" + emailto,
// data: dat,
Accept: 'application/json',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) {
// debugger;
},
error: function (result) {
// debugger;
}
});
}
else {
//your validation message goes here
return false;
}
});
});
Wcf service: IEmailService page
[OperationContract]
[WebInvoke(UriTemplate = "/EmailService1/emaildata?Email={Email}", ResponseFormat = WebMessageFormat.Json, RequestFormat = WebMessageFormat.Json, Method = "GET", BodyStyle = WebMessageBodyStyle.WrappedRequest)]
string emaildata(string Email);
wcf service code page:
public string emaildata(string Email)
{
//your email code.....
}
Web.config code:
<system.webServer>
<defaultDocument>
<files>
<add value="Service1.svc" />
</files>
</defaultDocument>
<handlers accessPolicy="Read, Execute, Script">
<add name="ISAPI64" path="*" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="None" preCondition="classicMode,runtimeVersionv4.0,bitness64" />
</handlers>
</system.webServer>
<system.serviceModel>
<services>
<service name="SampleService" behaviorConfiguration="ServiceBehaviour">
<endpoint address="" binding="webHttpBinding" contract="IService1" name="samendpoint" behaviorConfiguration="AjaxBehaviour">
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehaviour">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true" httpHelpPageEnabled="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="AjaxBehaviour">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" aspNetCompatibilityEnabled="true" />
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint name="" helpEnabled="true"
automaticFormatSelectionEnabled="true" />
</webHttpEndpoint>
</standardEndpoints>
</system.serviceModel>
and do't forget to add Factory setting in markup of wcf service by right click on wcf service in solution explorer and go to view mark up
Factory="System.ServiceModel.Activation.WebServiceHostFactory"
like in my code i set for example:
<%# ServiceHost Language="C#" Debug="true" Service="PSICMS.EmailService1" CodeBehind="EmailService1.svc.cs" Factory="System.ServiceModel.Activation.WebServiceHostFactory" %>
Try this:
[WebMethod]
public static string SendMail(string info)
{
return "";
}
Here info has comma separated values, you can split them and use.
Everything looks fine as far as calling the method. I'm assuming that your path to the method is incorrect. When I use this approach, the [WebMethod] would live in the code-behind of the same page, so I would use url: "Email.aspx/SendEmail I would also add an error handler to your $.ajax call to help with debugging. add this after your success handler. error: function(a,b,c){alert(a.responseText);} this should tell you what the problem is. You also don't need a script manager to make any of this work.

WCF service relative uri without .svc

I have a solution with 3 projects:
MEProject.WCF.ServiceLayer (Service-Implementation)
MEProject.WCF.HostConsole (Console Application which can host the service)
MEProject.WCF.HostIIS (WCF Service Application)
My goal is that I can switch between the 2 projects without changing the uri (the endpoint configurations) in the client project. Well, the problem is, if I start the console application, the endpoints are
http://localhost:8080/MultipleEndpointService/FirstEndpoint
http://localhost:8080/MultipleEndpointService/SecondEndpoint
But if I start the WCF service application, the endpoints are
http://localhost:8080/MultipleEndpointService.svc/FirstEndpoint
http://localhost:8080/MultipleEndpointService.svc/SecondEndpoint
As you can see, the difference is the ".svc". Now my question: How can I tell the WCF service application to act like the console application and not to have the ".svc" in the uri?
Here is the code I use to get the multiple endpoints in the console application:
public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
{
serviceHostBase.ChannelDispatchers.ToList().ForEach(channelDispatcher =>
{
ChannelDispatcher dispatcher = channelDispatcher as ChannelDispatcher;
if (dispatcher != null)
{
dispatcher.Endpoints.ToList().ForEach(endpoint =>
{
endpoint.DispatchRuntime.InstanceProvider = new CallBackInstanceProvider(serviceDescription.ServiceType, InstanceCreator);
});
}
});
}
And here is the WCF service application web.config:
<system.serviceModel>
<services>
<service name="MEProject.Service.WCF.HostIIS.MultipleEndpointService">
<endpoint name="FirstEndpoint" address="FirstEndpoint" binding="basicHttpBinding" contract="MEProject.Service.WCF.ServiceLayer.IFirstEndpoint"/>
<endpoint name="SecondEndpoint" address="SecondEndpoint" binding="basicHttpBinding" contract="MEProject.Service.WCF.ServiceLayer.ISecondEndpoint"/>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8080/MultipleEndpointService" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="True"/>
<serviceDebug includeExceptionDetailInFaults="False" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
Thanks in advance for your response!
for running a WCF without the SVC extension you will need to use routing
for example i have a service named MultipleEndpointService.svc and i want to get the service like the following:
.../MultipleEndpointService/FirstEndpoint
we can do it like this:
Global.asax:
public class Global : System.Web.HttpApplication
{
protected void Application_Start(object sender, EventArgs e)
{
RouteTable.Routes.Add(new ServiceRoute("MultipleEndpointService/FirstEndpoint", new ServiceHostFactory(), typeof(MultipleEndpointService)));
}
}
MultipleEndpointService.svc.cs:
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class MultipleEndpointService : IMultipleEndpointService
{
public string GetData(int value)
{
return string.Format("You entered: {0}", value);
}
public CompositeType GetDataUsingDataContract(CompositeType composite)
{
if (composite == null)
{
throw new ArgumentNullException("composite");
}
if (composite.BoolValue)
{
composite.StringValue += "Suffix";
}
return composite;
}
}
Web.config (for IIS7):
<system.webServer>
<modules runAllManagedModulesForAllRequests="true">
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</modules>
<handlers>
<add name="UrlRoutingHandler" preCondition="integratedMode" verb="*" path="UrlRouting.axd"/>
</handlers>
<directoryBrowse enabled="true"/>
</system.webServer>
source
Try URL ReWriting :
<system.webServer>
<!-- Other stuff here -->
<rewrite>
<rules>
<!-- Rewrite requests to /MultipleEndpointService.svc to /MultipleEndpointService -->
<rule name="MultipleEndpointService" stopProcessing="true">
<match url="MultipleEndpointService.svc(.*)" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="/MultipleEndpointService{R:1}" />
</rule>
</rules>
</rewrite>
</system.webServer>

Web Service WCF and Javascript

I have 2 projects (WCF project and Asp.Net project). I followed this tutorial here .
In this tutorial, we realize all in one project (see sources here).
I have a reference to my WCF project in Web project.
I try to display a value in my alert but there is nothing.
Here is my Service1.svc :
namespace WSSage100{
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Service1 : IService1
{
public string GetData(int value)
{
return string.Format("You entered: {0}", value);
}
public string GetData2(int value)
{
return string.Format("You entered: {0}", value);
}
public string[] GetUser(string Id)
{
return new User().GetUser(Convert.ToInt32(Id));
}
public string GetTEST()
{
return "OKKKKKKKK";
}
}
Here is IService1.cs :
namespace WSSage100
{
[XmlSerializerFormat]
[ServiceContract(Namespace ="WSSage100")]
public interface IService1
{
[OperationContract]
[WebInvoke(Method = "GET",ResponseFormat = WebMessageFormat.Json)]
string GetData(int value);
[OperationContract]
[WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json)]
string GetData2(int value);
[OperationContract]
[WebInvoke(Method = "POST",BodyStyle = WebMessageBodyStyle.Wrapped,ResponseFormat = WebMessageFormat.Json)]
string[] GetUser(string Id);
[OperationContract]
[WebInvoke(Method = "GET",ResponseFormat = WebMessageFormat.Json)]
string GetTEST();
Here is my web page (aspx) with JavaScript code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="javascript" type="text/javascript" src="JavaScript/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
var Type;
var Url;
var Data;
var ContentType;
var DataType;
var ProcessData;
function WCFJSON() {
var userid = "1";
Type = "POST";
Url = "Service1.svc/GetUser";
Data = '{"Id": "' + userid + '"}';
ContentType = "application/json; charset=utf-8";
DataType = "json"; varProcessData = true;
CallService();
}
function CallService() {
$.ajax({
type: Type, //GET or POST or PUT or DELETE verb
url: Url, // Location of the service
data: Data, //Data sent to server
contentType: ContentType, // content type sent to server
dataType: DataType, //Expected data format from server
processdata: ProcessData, //True or False
success: function (msg) {//On Successfull service call
ServiceSucceeded(msg);
},
error: ServiceFailed// When Service call fails
});
}
function ServiceFailed(result) {
alert('Service call failed: ' + result.status + '' + result.statusText);
Type = null;
varUrl = null;
Data = null;
ContentType = null;
DataType = null;
ProcessData = null;
}
function ServiceSucceeded(result) {
if (DataType == "json") {
resultObject = result.GetUserResult;
for (i = 0; i < resultObject.length; i++) {
alert(resultObject[i]);
}
}
}
function ServiceFailed(xhr) {
alert(xhr.responseText);
if (xhr.responseText) {
var err = xhr.responseText;
if (err)
error(err);
else
error({ Message: "Unknown server error." })
}
return;
}
$(document).ready(
function () {
WCFJSON();
}
);
</script>
<style type="text/css">
#form1 {
height: 255px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div></div>
</form>
</body>
</html>
Here is Service1.svc in my Web project :
<%# ServiceHost Language="C#" Debug="true" Service="WSSage100.Service1"%>
Here is my web.config in my Web project :
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<system.serviceModel>
<client>
<endpoint address="http://localhost:52768/Service1.svc" binding="basicHttpBinding"
bindingConfiguration="BasicHttpBinding_IService1" contract="WebServiceSage100.IService1"
name="BasicHttpBinding_IService1" />
</client>
<behaviors>
<serviceBehaviors>
<behavior name="">
<serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="EndpBehavior">
<webHttp/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService1" />
</basicHttpBinding>
</bindings>
<services>
<service name="WSSage100.Service1">
<endpoint address="" binding="webHttpBinding" contract="WSSage100.IService1">
</endpoint>
</service>
</services>
</system.serviceModel>
</configuration>
Brian, localhost:52768/Service1.svc display
I have this error when I use Inspect Element
I'm new in this domain and sorry for my bad english.
I had 2 projects in my solution, the WCF and an application console (GettingStartedHost) that will do to turn back the web service.
I also added the connectionstrings in app.config of the GettingStartedHost project and now it works well.

Calling a local WCF service via Scriptish or Greasemonkey

I'm trying to expose a local WCF service that checks to see if a file exists in my database that can be accessed from a Scriptish script.
Is it possible to call a local URL from Scriptish or Greasemonkey (GET or POST)? I've created a WCF service hosted in IIS on my local machine, and the service is working fine. However, when I try to call the service from Scriptish the Network tab in Chrome/Firefox just says the following:
Request URL: http://localhost/service/service.svc/MatchPartial
Request Method: OPTIONS
Status code: 405 Method Not Allowed
Here is my ajax call:
$.ajax({
url: 'http://localhost/service/service.svc/MatchPartial',
type: 'POST',
contentType: 'application/json; charset=UTF-8',
dataType: 'json',
processData: true,
data: '{ "partialFilename": "testing" }',
success: function (result) {
console.log(result);
}
});
My method is decorated with:
[WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json)]
public int MatchPartial(string partialFilename)
{
...
}
I have the following above my service class:
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
I've tried adding the following to my service with no luck:
[WebInvoke(Method = "OPTIONS", UriTemplate = "*")]
public void GetOptions()
{
WebOperationContext.Current.OutgoingResponse.Headers.Add("Access-Control-Allow-Origin", "*");
WebOperationContext.Current.OutgoingResponse.Headers.Add("Access-Control-Allow-Methods", "POST, GET, OPTIONS");
WebOperationContext.Current.OutgoingResponse.Headers.Add("Access-Control-Allow-Headers", "Content-Type");
}
I feel like I've tried everything. Any help would be appreciated!
I figured out how to do it via a GET request thanks to M.Babcock for pushing me in that direction (unimportant parts intentionally left out to save space).
Service.svc:
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Service : IService
{
[WebGet(ResponseFormat = WebMessageFormat.Json)]
public bool MatchPartial(string partialFilename)
{
...
}
}
Web.config:
<configuration>
...
...
<system.web>
<compilation debug="true"
targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
</system.web>
<system.webServer>
<httpProtocol>
<customHeaders>
<!-- IMPORTANT FOR THIS TO WORK USING JQUERY GET OR AJAX -->
<add name="Access-Control-Allow-Origin"
value="*" />
</customHeaders>
</httpProtocol>
</system.webServer>
<system.serviceModel>
<services>
<service name="MyNamespace.Services.WCF.Service">
<endpoint address=""
binding="webHttpBinding"
bindingConfiguration=""
contract="MyNamespace.Core.Interfaces.IService" />
<host>
<baseAddresses>
<add baseAddress="http://localhost/Service" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true" />
<!-- For Debugging --->
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior>
<webHttp />
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"
multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
</configuration>
Here's how to do it in Scriptish:
var service = "http://localhost/service/service.svc";
GM_xmlhttpRequest({
method: "GET",
url: service + "/MatchPartial?partialFilename=" + filename,
headers: { "Accept": "application/json" },
onload: function (result) {
if (result != null && result.status == 200 && result.responseJSON == true) {
videoFrame.remove();
}
},
onerror: function (res) {
GM_log("Error!");
}
});
Plain ol' jQuery:
$.get("service", { partialFilename: filename }, function (result) {
if (result == true) {
videoFrame.remove();
}
});

Why WCF service is not getting called in AJAX auto complete extender?

I am trying to consume a wcf service in auto complete extender but it is not getting called but the same thing i tried in web services it's working fine there.
Below is my sample code
In App_Code/AutoCompleteWCF.cs
[ServiceContract]
public interface IAutoCompleteWCF
{
[OperationContract]
[System.ServiceModel.Web.WebInvoke(Method = "POST",ResponseFormat = System.ServiceModel.Web.WebMessageFormat.Json)]
string[] GetCompletionList(string prefixText, int count );
}
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class AutoCompleteWCF : IAutoCompleteWCF
{
[OperationContract]
[System.ServiceModel.Web.WebInvoke(Method = "POST", ResponseFormat = System.ServiceModel.Web.WebMessageFormat.Json)]
public string[] GetCompletionList(string prefixText, int count)
{
string[] str = new string[5];
str[0] = prefixText + "A";
str[1] = prefixText + "B";
str[2] = prefixText + "C";
str[3] = prefixText + "D";
str[4] = prefixText + "E";
return str;
}
}
AutoCompleteWCF.svc
<%# ServiceHost Language="C#"Debug="true" Service="AutoCompleteWCF" CodeBehind="~/App_Code/AutoCompleteWCF.cs" %>
Web.confifg
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.5">
<assemblies>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
</behavior>
</serviceBehaviors>
<endpointBehaviors>
<behavior name="ServiceAspNetAjaxBehavior">
<enableWebScript/>
</behavior>
</endpointBehaviors>
</behaviors>
<services>
<service name="AutoComplete" behaviorConfiguration="ServiceBehavior">
<endpoint address="F" binding="webHttpBinding" contract="IAutoCompleteWCF" behaviorConfiguration="ServiceAspNetAjaxBehavior">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
</system.serviceModel>
</configuration>
WebForm1.aspx
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="AutoCompleteDemo.WebForm1" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ccl" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<ccl:ToolkitScriptManager ID="ScriptManager1" runat="server"></ccl:ToolkitScriptManager>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<ccl:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
BehaviorID="AutoCompleteEx"
TargetControlID="TextBox1"
ServicePath="AutoCompleteWCF.svc"
ServiceMethod="GetCompletionList"
MinimumPrefixLength="2"
CompletionInterval="1000"
EnableCaching="false">
</ccl:AutoCompleteExtender>
</div>
</form>
</body>
</html>

Categories