Skip to content
gimmi edited this page May 12, 2012 · 7 revisions

Getting started

  • Open Visual Studio and create a new "ASP.NET Empty Web Application", name it "Sample"
  • Got to "Tools" => "Library package manager" => "Add library package reference..." and add ExtDirectHandler library to the project
  • Add a new class to the project, name it EchoService and set the following content:
namespace Sample
{
	public class EchoService
	{
		public string Echo(string value)
		{
			return value;
		}
	}
}
  • Add Global.asax to the project and modify "Application_Start" method as follows
protected void Application_Start(object sender, EventArgs e)
{
	var metadata = new ExtDirectHandler.Configuration.ReflectionConfigurator()
		.RegisterType<EchoService>();
	ExtDirectHandler.DirectHttpHandler.SetMetadata(metadata);
}
  • Edit Web.config and add the following line under <configuration> <system.webServer> <handlers>

<add name="ExtDirectHandler.DirectHttpHandler" verb="*" path="rpc" type="ExtDirectHandler.DirectHttpHandler, ExtDirectHandler" />

Note: if you are using IIS6 or older, or Visual Studio development server, the above configuration must be added under <configuration> <system.web> <httpHandlers> instead.

  • Create a file index.html in the root of your project and add the following content
<html>
<head>
	<title></title>
	<script type="text/javascript" charset="utf-8" src="http://cdn.sencha.io/ext-4.0.2a/ext-all-debug-w-comments.js"></script>
	<script type="text/javascript" src="rpc"> </script>
	<script type="text/javascript">
		Ext.onReady(function() {
			Ext.direct.Manager.addProvider(Ext.app.REMOTING_API);
			EchoService.echo('Hello World!', function (result) {
				alert(result);
			});
		});
	</script>
</head>
<body></body>
</html>
  • Run application and go to index.html, an alert saying "Hello World!" should pop up
Clone this wiki locally