Tagged Questions
-2
votes
0answers
13 views
cookie web mvc and token webapi
I have a web app, that is using cookie authentication, I want to see what approach best suite for accessing a WebAPI 2. The web application is making client side calls to the API service. What is the ...
0
votes
1answer
24 views
Consuming ASP.NET Web API from classic ASP to download file
I have a legacy Classic ASP application that serves as a repository for a bunch of files available for download. I would prefer to not rewrite the entire application at this time but instead want to ...
0
votes
1answer
35 views
How to bind the dropdownlist in MVC WebAPI?
I am trying to bind dropdown fiels in my razor from webapi controller. Why it is not accepting the view in my webapi. whether the view() accepts only in the controller not the apicontroller? I am ...
-2
votes
1answer
16 views
Which cms to develop Asp.net websites [on hold]
I want to use a cms to develop website in asp.net mvc
I want to use webapi as service management and i need easy to develop modules.
I want to find ready to use features like,
1 create page
2 ...
0
votes
0answers
22 views
Custom Validation for Web API Controller
I am creating MVC 5 Application. I have a button that when clicked goes to a WebApi Controller method. I have used the following article to create a ValidationFilter Attribute above my Web API ...
0
votes
1answer
33 views
REST API HttpClient return response good practice
I have methods that are returning objects, the problem is I don't have good idea how to verify errors and return it correctly in MVC View
public async Task<object> GetUser()
{
...
0
votes
1answer
22 views
Azure Table Storage best practice for ASP.NET MVC/WebApi
What are the best practices for connecting to a Azure Table Storage from a ASP.NET MVC or Web API app?
Right now I've made a StorageContext class which holds a reference to the CloudStorageAccount ...
1
vote
1answer
33 views
Adding nuget packages for a webapi project
I am trying to change the default location of nuget packages
I have a nuget.config file in the same location as the solution file.
Its contents are
<?xml version="1.0" encoding="utf-8"?>
...
1
vote
0answers
23 views
Authentication with oAuth and ASP.NET MVC + WebApi
We are going to start developing our new site with asp.net MVC and AngularJS. I will also have a webApi that i would like to use oAuth authentication with, because it is easy to to pass in token, ...
1
vote
1answer
41 views
Sending a validation email to new registered users to activate their accounts
in asp. net web api i am trying to send confirmation mail to new registered user that have a link when click they activate their account i have managed to send email through SmtpClient and ...
0
votes
1answer
32 views
Post to web api the object is always null
This is the post method in my api controller
[HttpPost]
[CheckModelForNull]
[ValidateModelState]
public HttpResponseMessage Post([FromBody] DepModel depModel)
{
try
{
var entity = ...
0
votes
1answer
31 views
How to update a claim in ASP.NET Identity?
I'm using OWIN uthentication for my latest MVC5 project.
This is my code for Signin
private async Task SignInAsync(ApplicationUser user, bool isPersistent)
{
var AccountNo = ...
1
vote
0answers
32 views
Single authentication pipeline for webapi, mvc and signalr supporting basic and forms
My current services are using MVC to render forms, WebApi to move my viewModels back and forth and signalR for push notifications etc.
If the users are browsing the website they will be using forms ...
0
votes
2answers
24 views
What is the correct REST Urlpattern for POST operation
I have rest url support POST request. its looks like
api/country/{countryId}/state
using to create state resource in a country with given id
but the mapping function of this url is
public ...
0
votes
1answer
18 views
MVC - Access Sessions From Web API
Using MVC
I am authenticating a user by calling a Web API from ajax.
Naturally, after authentication, I want to assign session("LoggedIn") the value True.
But the session in my Web API keeps ...
0
votes
2answers
39 views
How to call web api with data
In my web api controller i have two functions with following structure
public HttpResponseMessage Post(CountryDto country)
{
var countries = _countryAppService.RegisterNewCountry(country);
...
0
votes
1answer
21 views
Select one item in Web Api 7 Mvc4
i am very new in webapi
i am trying to list items using web api and jquery in mvc4 project.(i use dummy data for that)
for list all item i use the following codes in controller and jquery
public ...
5
votes
5answers
89 views
Why use ASP.Net Web Api instead SignalR for internal project
I know, ASP.NET Web API is designed for creating restful APIS, while SignalR is for realtime communication. So they are not competing technologies.
Imagine this: you are creating a client/server ...
0
votes
0answers
41 views
Custom Controller Selector for MVC as in WebAPI
In WebAPI, I can execute the following code in WebApiConfig.cs to implement my own logic of selecting a controller based on the route:
config.Routes.MapHttpRoute(
name: "DefaultApi",
...
0
votes
2answers
27 views
Does NuGet automatically upgrade installed packages to new versions?
I see that there are new versions of ASP.NET MVC and Web API
If a solution references these NuGet packages, will it automatically update them to these newer versions with options set thus:
?
0
votes
1answer
29 views
Is using AngularJS and WebApi good for large complex systems? Questions also
We currently have an asp.net webforms web application, which needs updating in terms of look and speed. I think its time to redevelop it and was thinking about creating a webApi and change the ...
0
votes
1answer
26 views
Why Web Api add extra $id to result set
I have Web Api service that return enumerable list of some object,
but i see in client side some extra $id for each object ?
why I am getting it ? What is the reason ? is is possible to deactivate it ...
0
votes
0answers
44 views
Web API action executes successfully but I see no response in the client application
From an ASP.NET MVC app, I make a POST request to an action on my Web API. The action in the API executes successfully. When I make the same request in a REST client such as Postman for Chrome, I see ...
0
votes
1answer
29 views
PushStreamContent and ionic.zip
My webapi method for zipping on the fly use this code
var result = new HttpResponseMessage(HttpStatusCode.OK)
{
Content = new PushStreamContent((stream, content, arg3) ...
0
votes
1answer
24 views
ASP.NET MVC WebAPI in Application Area
I am trying to use WebAPI as part of an MVC5 application. The application has areas, so to keep with the existing structure I have created and "API" area. However, I am having some routing troubles as ...
0
votes
0answers
30 views
Get an image from a method with ActionResult as return type
I'm working on a Web Api project and I'm getting an image from a controller in a MVC project. The return type is ActionResult. The method GetImage in the Web Api has HttpResponseMessage as the ...
1
vote
0answers
54 views
Allowing only client side app to access WEB API?
I want to make a better use of javascript frameworks in combination with ASP.NET MVC and since I am exposing WEB API to js frameworks it means that I am exposing them to the end user.
How can i ...
0
votes
0answers
54 views
How to deal with DataAnnotations attributes in ASP.NET Web API on string.Empty values?
I struggle with the usage of System.ComponentModel.DataAnnotations validation attributes in ASP.NET Web API and ASP.NET MVC with string.Empty or null values. What would you recommend is the best ...
0
votes
0answers
32 views
C# Property Type Validation. Check Type of model property
I am using DTO on my Asp Web Api application.
There are many Default Attributes for validation models. Such as: MaxLength, Required and so on...
Is there attribute, which check type of model ...
1
vote
1answer
47 views
A simple POST request to Web API not hitting the API at all
From my MVC application, I am trying to make a POST request to these sample end-points (actions) in an API controller named MembershipController:
[HttpPost]
public string GetFoo([FromBody]string foo)
...
0
votes
0answers
23 views
Attempt by method 'HttpConfiguration..ctor(HttpRouteCollection)' to access method 'HttpConfiguration.DefaultFormatters()' failed
I have a Web API that has version 5.1.2 of the Microsoft.AspNet.WebApi.Client package installed.
I am trying to access the API from an ASP.NET MVC application, which also has the same version of the ...
-1
votes
1answer
32 views
Controller to get and return an RSS XML file
I've been asked to wrap an RSS request into an ASP.NET WebAPI controller. What's the best way to do this?
1
vote
0answers
32 views
How should a C# Web API model binder provider work?
I have the following:
request url: 'endpoint/1,2,3?q=foo'
action to which the request is bound:
public object Bar([ModelBinder] List< T > ids, [FromUri] string q)
I want to map the "1,2,3" ...
0
votes
1answer
34 views
How to get Authorization information from ASP.NET MVC cshtml and set it to Headers[“Authorization”] of jquery ajax
How to get Authorization from ASP.net MVC cshtml and set it to Headers["Authorization"] of jquery ajax.
I success login to ASP.NET MVC and use FormsAuthentication.SetAuthCookie(model.Name, ...
0
votes
3answers
48 views
Where is the proper place to add a method to handle SQL Connection String in ASP.NET WebAPI
I have a set of many databases that follow the same schema and I've abstracted the pertinent tables in the Model layer of the application. I'm using SQLConnections to handle connecting to the database ...
0
votes
1answer
22 views
Transform Results Of Web API Actions
How do I transform the results of my controller actions before the framework formats it?
Suppose I have a controller like:
public class Controller : System.Web.Http.ApiController {
public ...
0
votes
1answer
31 views
Is there a way I can run a Database.SqlQuery as async?
I have the following:
var sql = @"Select
case when Test.TestTypeId = 1 then Exam.Name
when Test.TestTypeId = 2 then Topic.Name
end as Name,
...
1
vote
1answer
48 views
Is there any difference in performance between Database.SqlQuery and EF 6.1?
I have two different ways to get data from my SQL database:
var sql = @"Select Exam.Name, Test.TestId, Test.QuestionsCount, Test.Title
FROM Test
INNER JOIN Exam
...
0
votes
0answers
25 views
Combining tokens and cookies auth for MVC 5 / Web API app
I have a web app that contains:
Normal MVC controllers - must use cookie auth only
Web API Controllers, that are used internally by the app (jquery calls etc) - should use cookie auth also
Web API ...
0
votes
2answers
40 views
“No owin.Environment item was found in the context” exception in ASP.NET Mvc/Web Api application
We've got an MVC 5.1 app that works with Autofac DI. I've implemented some basic web api functionality to pull and post data which works. We now want to add authentication on the web api controllers. ...
0
votes
0answers
34 views
Ninject WebApi Issue within MVC App
I currently have a working MVC 5 application which uses Ninject for dependency injection.
I am now taksed with adding some Web API controllers to this project, and I want to use dependency injection ...
0
votes
2answers
38 views
WebAPI not serializing inherited class on POST?
Here is my controller method:
[System.Web.Http.HttpPost]
[System.Web.Http.Route("api/exercise")]
public HttpResponseMessage CreateExercise(ExerciseDto exercise) {
Here are my classes:
...
0
votes
2answers
19 views
Can't access local to Web Api from AngularJS
I've build Web Api and inside the project included a web site built with AngularJS. When I start the project it points to my web site and opens it. In AngularJS controllers I call methods from the web ...
-1
votes
0answers
42 views
two way communication in .net C# mvc
I have to create one webapi so that that can be accessed from any where.
Second thing that is to be developed is web site which contains reference of above web api.
Third thing is to develop is ...
2
votes
2answers
64 views
Binding values to HTML dropdownlist using JQuery with ASP.NET MVC WebAPI - Cannot read property '0' of undefined
I am trying to populate values for html drowpdown using JQuery from webapi url. JSON returns value and I've verified it using alert function. But, when I bind those into dropdown it is not populating ...
0
votes
1answer
40 views
Exposing EF6 model subsets via WebAPI
For example, I have a EF6 model like this:
class User
{
public int Id { get; set; }
public string Email { get; set; }
public string Name { get; set; }
public virtual ...
0
votes
1answer
52 views
Linq Contains show all the results in Asp.net Wep api
I got some issues in Asp.net Web Api. here is my Linq statement and used it for autocomplete.
(from usr in UserProfile
where usr.MobileNo.Contains('973')
select usr).ToList();
Inside my UserProfile ...
0
votes
2answers
29 views
Why call ASP.NET WebAPI package libraries with version 5.1.0 as ASP.NET WebAPI 2.1?
I want to get started with ASP.NET MVC and WebAPI that was released in Jan 2014.
ASP.NET MVC 5.1, ASP.NET Web API 2.1 and ASP.NET Web Pages 3.1 (Ref: NuGet)
I created a new ASP.NET Web application ...
0
votes
1answer
23 views
How can I handle exceptions in WebAPI 2. methods?
In my WebAPI 2.1 application I am processing inserts like this:
[Route("Post")]
public async Task<IHttpActionResult> Post([FromBody]City city)
{
if (!ModelState.IsValid)
...
0
votes
0answers
19 views
Add additional parameter to Kendo Grid web api request [duplicate]
I am using Kendo UI MVC Grid with Web API controller. I got the source code for a sample project here
Partial view of code in my cshtml page is:
.DataSource(dataSource => dataSource
...