All Questions
Tagged with asp.net-web-api2 asp.net-mvc-5
265 questions
2
votes
2
answers
2k
views
How to provide model documentation and example value using Swashbuckle?
I have created an API method using Web API 2 (MVC 5), as shown below:
/// <summary>
/// Import all of the jobs for the given organisation. This method assumes that all of the organisation's ...
1
vote
1
answer
85
views
remove inverse relationship in ASP.NET Web API 2 / MVC 5
I'm trying to remove the inverse part of the relationship between VISITORDRIVER and USER when calling the API to get users. In this case VISITORDRIVER table has foreign key as USER table. Below is the ...
1
vote
1
answer
612
views
How to return File with custom Message
I use HttpResponseMessage to return a file to front-end :
public HttpResponseMessage Post(string version, string environment,
string filetype)
{
var path = @"C:\Temp\a.txt";
...
1
vote
0
answers
802
views
Swagger UI not working for REST API (asp.net web api2) application
I have asp.net mvc project with .NET Framework 4.7.2 and the same project contains asp.net web api2 controller in a separate folder : Controllers. The solution is legacy. The API are already in use in ...
0
votes
1
answer
278
views
Why would the ASP.NET MVC HttpFileCollection return an array of strings rather than a Collection of HttpPostedFile?
I have an AngularJS + ASP.NET MVC 5 application where I am attempting to implement single file uploading.
On the client side I have the following code:
api.uploadFileV2 = function (alias, file, ...
1
vote
0
answers
193
views
URI to Web API action not working when application is published to IIS as a Web Application under Default Web Site
I have added Web API 2 to an existing MVC 5 web application. I use methods of this Web API to return JSON data to MVC Views.
This is an example of an ajax call inside a view:
$.getJSON('@Url....
0
votes
1
answer
147
views
Need a common object between httpcontext and httpcontextbase
I'm using both asp.net mvc 5 and asp.net web api 2 owin based web application.
The first one is the website and the second one is the backend api.
I need to share some libraries,
in the asp.net mvc ...
2
votes
1
answer
5k
views
No assembly found containing a Startup or [AssemblyName].Startup class
I've tried resolving this from answers in other and similar posts, but no luck.
I'm Using MVC 5, framework 4.8 latest VS2017.
Thanks
My Config is: (including other attempts)
<configuration>
...
0
votes
0
answers
376
views
Using ASP.NET identity on multiple applications for 2 websites
I am going to develop 2 websites site1.com, site2.com and mobile APIs api.com
site1.com for admin
site2.com for portal
Api.com for mobile
So, shall i use the same identity for all of them or use one ...
1
vote
1
answer
465
views
Web Api attribute routing won't match POST request
I have attribute routing on all the actions on my controller (though there is a default conventional route defined). I have (I think) tried every combination of using [HttpPost] or not, and using [...
1
vote
1
answer
364
views
Properties with different names null when posting to MVC Controller but not WebApi Controller
I have a model called Purchase with various properties:
public class Purchase
{
[JsonProperty(PropertyName = "amount", NullValueHandling = NullValueHandling.Ignore)]
public int Amount
{
...
1
vote
0
answers
124
views
Is the Action passed to PushStreamContent guaranteed to be called?
The WebApi's PushStreamContent accepts an Action<> or a Func<> that is named "onStreamAvailable" and is supposed to be
called when an output stream is available, allowing the action to ...
5
votes
1
answer
5k
views
MVC5 Web API and Dependency Injection
Trying to do some DI on Web API 2 without third-party tools.
So, from some examples I've got custom dependency resolver (why there's no integrated one? Strange, even Microsoft.Extensions....
1
vote
0
answers
76
views
Suggestion on how to implement conditional dependency?
I have two classes implementing the interfaces. Both the classes execute place search functionalities. Also in both the classe constructor there is a common functionality depending on the classes
...
0
votes
1
answer
594
views
How to check whether user is logged in or not from controller in Token Based Authentication using MVC 5?
I have ActonResult Data() in HomeController, I want to show Data.cshtml the only user already logged in. otherwise, it will return LogoutView.cshtml page
HomeController
public ActionResult Data()
...