Using AJAX object with ASP.NET WEB API

2

Index

Stats

5,347 visits, 13,843 views

Translations

This tutorial hasn't been translated.

Tools

Getting things ready... step 2 of 4

Before we start we must make some adjusts, it will make things easier in the next steps ;)

Tip: You can download a template project at Tutorial Downloads with all code and packages you'll need to start coding ;) If you like to download it, jump to Step 6.

Changing the default project's Route

1. Open the WebAPIConfig.cs file at App_Start folder

2. Search for this line of code:

    routeTemplate: "api/{controller}/{id}",

And replace with:

    routeTemplate: "api/{controller}/{action}/{id}", // New route with Action

This will allow you to call functions by their names on the server from a Construct game.

Click Save in the toolbar or press Ctrl + Shift + S to save all.

Before continue...

Now, try to build the project by clicking BUID > Build Solution. If it fails, go back and revise your code.

  • 2 Comments

  • Order by
Want to leave a comment? Login or Register an account!