0
votes
0answers
55 views

Data model validation throws internal server error, when using single model in more than one action method

Below is the validation attributes for the datamodel class RegisterModel public class RegisterModel { [Required, Maxlength(7)] public string Email { get; set; } } If the above datamodel ...
0
votes
1answer
76 views

MVC to WebAPI authentication for the same application

I'm building a website that will have an MVC side and will get its data from a WebAPI backend of our own, but most likely hosted on a different server (or even on Azure). We're going to use Forms ...
3
votes
1answer
38 views

ASP.NET MVC4 Web API Controller Stuck on One Route

I created a new ASP.NET MVC4 Web Api Project. In addition to the default ValuesController, I added another controller, ScenarioController. It has the exact same methods as ValuesController. But for ...
1
vote
0answers
38 views

Web Api Token Authentication

I have read so many articles and watched loads of videos about security in .NET web api and not I want to create my own. My scenario is this: I need clients to be able to SECURELY access my API. I ...
0
votes
2answers
44 views

Default Authorization role at Controller level and override at method

I'm trying to set default access to the methods on my controller, so I've added the [Authorize] attribute on my ApiController. For the most part, unless overridden with the [AllowAnonymous] attribute ...
0
votes
1answer
20 views

WebAPI Custom ModelBinder inheritance

I am trying to bind to the parent of a certain object type using WebAPI BindParameter. I am able to bind to the object itself (SomeObject), but not its parent (SomeOtherObject). This would cause me to ...
0
votes
1answer
50 views

Azure Mobile Services vs Web API

I have just started using Web API to create REST based services to be used within my MVC apps, which I am calling a lot from client side code. Now I have noticed Azure Mobile Services provides an ...
0
votes
1answer
44 views

Same Project Solution or New Project in Same Soultion - Asp.net MVC / Web Api?

I am wondering what is the better way to go. I created a webapi project and am currently working on making my api. In the future I want a full asp.net mvc 4 website and that could also contain forms ...
2
votes
1answer
121 views
+50

MVC WebApi endpoints do not work on production, but regular endpoints do

I have an ASP.NET MVC project that runs perfectly locally. It has some controllers that inherit from Controller and some that inherit from ApiController. My routes are below. When I run the project ...
2
votes
2answers
49 views

Multiple view for multiple devices in ASP .Net MVC

What can be the best way for architecting an ASP .Net MVC project, which have common web service part and multiple views for multiple devices. I have started with a JQuery mobile project, and have ...
1
vote
3answers
60 views

Passing array of integers to webapi Method

I am trying to pass an array of int but I can not get the value in the webapi method var postData = { "deletedIds": deletedIds }; $.ajax({ type: "DELETE", traditional: true, ...
2
votes
3answers
61 views

Does it Make Sense to have ViewModels in the Webapi?

I am starting to learn the webapi and find myself doing stuff that makes sense in an MVC project but may not make sense in. Normally in an MVC project I make ViewModels and use that as the parameter ...
0
votes
1answer
37 views

How to know when a response has finished being sent to the client?

I have a Web API web method which returns a list of Events in xml: public IList<Event> GetAllEvents() { ... } public class Event { public string Name { get; set; } public int Id { ...
1
vote
1answer
171 views

Logging framework vs System.Diagnostics Tracing

As I'm currently setting up Logging in my (Asp.Net Web Api) application I was reading about best practices according logging. I came along this question about logging best practices. I was going the ...
5
votes
2answers
216 views

Client Side Validation with WebApi

I am attempting to perform client side validation on my objects that come back through WebApi. I send the entity through webapi to my Entity edit screen. I use knockout to bind the object to the ...
1
vote
3answers
323 views

Web API, OData, $inlinecount and testing

I previously had a Web API controller that looked like this: public IQueryable<ApiDesignOverview> GetList( string brandIds = "", string categoryIds = "", string ...
15
votes
2answers
504 views

How do I get ASP.NET Web API working with versioning and the Help Page extension?

I've implemented a versioning framework into my WebAPI application, and would very much like to get it working with the new Help Page extension from Microsoft. Microsoft.AspNet.WebApi.HelpPage ...
1
vote
1answer
37 views

How can I structure a REST API endpoints for MS Web Api cleanly?

I have a data model called PIM (Product Info Manager) that requires that I pass a company AppId for every request. So if I want to get all the products I would pass a Company AppId and the resource ...
0
votes
2answers
43 views

WebApi routing not passing value

I am trying to pass a value to a controller / action in Web Api but it's not finding it. My Route Mapping: config.Routes.MapHttpRoute( name: "DefaultApi", ...
2
votes
1answer
34 views

How would I extend WebAPI to support returning controller action results via an HTTP callback?

I'm trying to extend WebAPI to support returning a response through an HTTP callback. Workflow: WebAPI receives a HTTP request with a callback URL. WebAPI handles the URL normally and if the ...
0
votes
1answer
31 views

Using Custom IHttpActionInvoker in WebAPI for Exception Handling

I'm trying to add a custom IHttpActionInvoker to my WebAPI application in order to prevent the need for lots of repeated exception handling code in my action methods. There really doesn't seem to be ...
1
vote
0answers
40 views

Versioning an API [migrated]

I'm starting a side project, the first stage will be a building a web application with MVC, in later stages we will be adding clients for mobile platforms. My thought was to create one API that all of ...
22
votes
3answers
9k views

Returning binary file from controller in ASP.NET Web API

I'm working on a web service using ASP.NET MVC's new WebAPI that will serve up binary files, mostly .cab and .exe files. The following controller method seems to work, meaning that it returns a file, ...
0
votes
2answers
62 views

asp.net mvc api json wrapper

I Have an asp.net mvc api controller method that has a List as its return method. When called it returns this json data: [ { "AreaName": null, "AreaId": 0, "DestinationName": "Alanya", ...
5
votes
3answers
126 views

Restful Webservices comparison WebAPI vs MVC

I was told to design an API for a client to manipulate some data. Now, trying to keep up with the Jones', I've designed this using WebAPI. I post to my Restful Webservice an object via $.Ajax Why is ...
0
votes
1answer
120 views

WebAPI and Forms Authentication CookieContainer

I successfully login to an MVC 4 Web API site and get a .ASPXAUTH Set-Cookie this way: private void Login() { var client = new RestClient("http://QQQQ/MobileAPI"); ...
47
votes
3answers
12k views

Difference between ApiController and Controller in ASP.NET MVC

I've been playing around with ASP.NET MVC 4 beta and I see two types of controllers now: ApiController and Controller. I'm little confused at what situations I can choose a particular controller. ...
0
votes
1answer
50 views

Use Ajax forms for my requests or consume a RESTful service from a browser that only supports GET and POST methods in mvc4 web api

I am working on mvc4 web api application I am using @{ AjaxOptions addAjaxOpts = new AjaxOptions { OnSuccess = "getData", Url = "/api/reservation" }; } ...
1
vote
2answers
129 views

Asp Web Api async action - 404 error

I've got some api controller with this action: public class ProxyController : ApiController { public async Task<HttpResponseMessage> PostActionAsync(string confirmKey) { return ...
0
votes
2answers
87 views

How should I secure my SPA and Web.API?

I have to implement a web site (MVC4/Single Page Application + knockout + Web.API) and I've been reading tons of articles and forums but I still can't figure out about some points in ...
1
vote
2answers
81 views

Redirect from one api controller method to another, and reapply custom authorize filters

In WebApi I have a controller action that I want to be able to redirect to another ApiController action. I decorate these methods with custom AuthorizeAttribute (CustomAuthorizaton) properties so it's ...
9
votes
2answers
2k views

Side by side Basic and Forms Authentication with ASP.NET Web API

Disclaimer: let me start by saying that I am new to MVC4 + Web Api + Web Services in general + JQuery. I might be attacking this on the wrong angle. I am trying to build a Web MVC App + Web API in ...
0
votes
1answer
52 views

Asp.Net WebApi get result

I have the following controller in an ASP.Net WebApi project. The model is generated with Entity Framework. public class CategoriesController : ApiController { private ...
12
votes
5answers
3k views

ASP.NET MVC 4 Application Calling Remote WebAPI

I've created a couple ASP.NET MVC applications in the past, but I've never used WebAPIs before. I'm wondering how I could create a simple MVC 4 app that does simple CRUD stuff via WebAPI instead of ...
1
vote
1answer
183 views

Asp MVC and Web Api Async Controllers

I was working with Asp MVC 3, and in my application was created Async controller with some methods like: public void ActionAsync() { AsyncManager.OutstandingOperations.Increment(); ...
0
votes
0answers
47 views

Connecting to WebAPI from different clients

I've come across a number of posts describing the Web API pipeline. In particular, I saw how you are able to inject some code into the MessageHandlers by inheriting from DelegateHandlers. The ...
3
votes
1answer
497 views

Why are my ASP.Net MVC4 WEBAPI ActionFilter being ignored at runtime?

I'm trying to use an ActionFilter attribute so I can intercept the OnActionExecuting event and do a token validation in my web api code... Below is some code stripped of my security things(a pretty ...
5
votes
2answers
1k views

Microsoft ASP .NET Web API, MVC 4 and SPA Architecture

Microsoft recently released MVC 4 Beta, which has these new very nice features like Web API and SPA. And as always Microsoft's demos do not demonstrate best practices from software design ...
2
votes
2answers
368 views

How do you return a custom 503 message?

I have a service implemented in MVC4 / ASP.NET Web Api. I would like to return a custom 503 message to my clients when the system is down for maintenance. I have the following code: public ...
0
votes
1answer
29 views

Single Sign On and Database Queries

I have a mssql database with a users table and tables for about 6 different applications. Each application has it's own schema inside the database. When a user logs in, the user is show a list of ...
0
votes
2answers
53 views

Using IQueryable select to filter columns

I've been exploring WEB API based on the guide at www.asp.net, and I've run into a problem when trying to filter columns from a table. My code is simply this: // GET api/Admin public ...
7
votes
2answers
420 views

Web API Queryable - how to apply AutoMapper?

I've got a simple WebApi method like this decorated with the OData queryable attribute. [Queryable] public virtual IQueryable<PersonDto> Get() { return ...
0
votes
0answers
73 views

When listbox items are selected controller takes null parameter

I have multiple textboxes in my form which is sending ajax request with a certain Web-Api. However, when i add a listbox to my controls and select an item from it parameter of post api controller ...
1
vote
2answers
297 views

ApiController GET Action naming

I have an ApiController with multiple GET Actions. The problem is that I wan't to name my actions without "Get" in the start of their names. For instance, I can have an Action named "GetImage" and ...
2
votes
2answers
2k views

Queryable attribute is not compiling in mvc 4 web api when trying to mark for odata

I'm using MVC 4 web api that comes with visual studio 2012. As I've understand odata is not parsed automatically, but we need to add [Queryable] attribute to the action now. So I added it: public ...
1
vote
1answer
84 views

Using 'Paste XML as Classes' to deserialize a Web API rest response

I am having trouble using the 'Paste XML as Classes' feature in VS2012 to properly deserialize XML results from a Rest call using Web API. The XML response from the call looks like this: <?xml ...
0
votes
1answer
63 views

Getting Error 405 in POST and 404 in GET

I have a MVC4 WebApi project working in dev environment, but got error when deploy to production. I got httperror 405 when doing a POST, and 404 error when doing GET. I know that the problem is my ...
1
vote
2answers
1k views

No MediaTypeFormatter is available to read after deployment to prod

I have a webapi project mvc4 rc and a mvc4 rc web application deployed on a server. Locally everything works correctly however on the server I get an error 2012-06-09 03:18:18,659 [23] INFO ...
0
votes
1answer
26 views

Extending MediaTypeFormatter selection

In some cases i want to select MediaTypeFormatter manually. Is there any way to do this? For example if User Agent is Opera, always return data in JSON format
1
vote
2answers
633 views

Asp.Net MVC4 + Web API Controller Delete request >> 404 error

I have a VS2012 MVC4 solution where I test Web API Controllers. I successfully tested the GET, POST, PUT but the DELETE still got me an http 404 error. When I set a breakpoint in my 'DeleteMovie' ...

1 2 3 4 5 17
15 30 50 per page