13

I would like to use WebAPI for an existing project of mine (classic ASP.NET), but as far as I can tell you can only use WebAPI with MVC.

Is it possible to use WebAPI with ASP.NET?

asked Apr 24, 2012 at 21:58

2 Answers 2

19

From the linked page:

Although ASP.NET Web API is packaged with ASP.NET MVC, it is easy to add Web API to a traditional ASP.NET Web Forms application. This tutorial walks you through the steps.

To use Web API in a Web Forms application, there are two main steps:

Add a Web API controller that derives from the ApiController class. Add a route table to the Application_Start method. Create a Web Forms Project

Start Visual Studio 2010 and select New Project from the Start page. Or, from the File menu, select New and then Project.

In the Templates pane, select Installed Templates and expand the Visual C# node. Under Visual C#, select Web. In the list of project templates, select ASP.NET Web Application. Enter a name for the project and click OK.

Pieter Goosen
9,9615 gold badges37 silver badges58 bronze badges
answered Apr 24, 2012 at 22:05

2 Comments

what happened to the link. It was working yesterday but now getting 404 The page you are looking for is not available...
I report the link issue and they updated me the new link. I have updated the same in answer.
8

ASP.NET Web API and ASP.NET MVC live in two different worlds albeit parallel worlds.

Web API has been designed and built with no dependency to ASP.NET MVC but has been built on the top of ASP.NET.

So the answer to your question - with confidence - is true. Brad Wilson himself mentioned this on a podcast recently.

answered Apr 24, 2012 at 22:35

1 Comment

While informative, this post doesn't actually answer the "how to?" part of the OP's question...

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.