asp.net-web-api2

Mix Windows Authentication and individual accounts in web api

丶灬走出姿态 提交于 2019-12-25 16:42:37
问题 I have a web API that use Individual accounts and issue tokens properly. I modified it to accept social authentication from native application. Now, I want to add options for internal employees to access that API using their domain credentials rather than creating new username and password. Employees should call the api/token to get a token, however, they will pass in the body, the domain credential. Any ideas on how to differentiate between normal username and password and domain credentials

Quartz.net Scheduler is working on local while debugging but not on production

送分小仙女□ 提交于 2019-12-25 14:39:12
问题 I have used Quartz.net for scheduling some task. The problem is that it's working only while debugging in the local. The code is not working on my local server and production as well. Please don't mark it as duplicate because none of the solution mentioned in other questions solved my issue. public class JobScheduler { public static ISchedulerFactory schedFact; public static IScheduler sched; public static void Start() { schedFact = new StdSchedulerFactory(); // get a scheduler sched =

Missing values in the HttpContext Session when accessed in the WebApi 2.0 custom Authentication Filter

怎甘沉沦 提交于 2019-12-25 13:44:50
问题 In my web services (WebApi 2.0), I have implemented IAuthenticationFilter which checks some values in the HttpContext.Current.Session (E.g. HttpContext.Current.Session["TokenId"]) and decides whether user is authorized to proceed or not. I have registered this filter in the FilterConfig class like following so that this filter is executed everytime anybody is calling Web Api. config.Filters.Add(new WebApiAuthenticationFilter()); My MVC 4 application has a custom AuthorizeAttribute . This

dealing with dynamic properties on oData client

血红的双手。 提交于 2019-12-25 12:12:22
问题 I have the following class on both server and client public class Entity { public string Id {get; set;} public string Name {get; set;} public Dictionary<string, object> DynamicProperties {get; set;} } As far as I have seen all the examples of open type describes about having dynamic properties on the server side, but the properties on the client needs to be explicitly declared.When I send a POST request from the client how do i send the dynamic properties ?. I can't declare all the dynamic

dealing with dynamic properties on oData client

眉间皱痕 提交于 2019-12-25 12:12:01
问题 I have the following class on both server and client public class Entity { public string Id {get; set;} public string Name {get; set;} public Dictionary<string, object> DynamicProperties {get; set;} } As far as I have seen all the examples of open type describes about having dynamic properties on the server side, but the properties on the client needs to be explicitly declared.When I send a POST request from the client how do i send the dynamic properties ?. I can't declare all the dynamic

Consuming WEB API using HttpClient in c# console application

守給你的承諾、 提交于 2019-12-25 08:50:10
问题 I have created a web API in visual studio 2015 using MySQL Database. The API is working perfect. So I decided to make a console Client application in which I can consume my web-service (WEB API). The client code is based on HttpClient , and in API i have used HttpResponse . Now when I run my console application code, I GET nothing. Below is my code Class class meters_info_dev { public int id { get; set; } public string meter_msn { get; set; } public string meter_kwh { get; set; } } This class

OData V4 client adding child entity

Deadly 提交于 2019-12-25 08:49:22
问题 I have a parent (Order) and child (OrderDetail) where Order already exists in the database and OrderDetail also exists in the database. All I really want to do is add another OrderDetail record bound to the Order. I have been down several paths and I'm not even sure what is the correct path. Let's make some assumptions that navigations between these are already working. I can $expand=OrderDetails fine and I can also Orders(1)/OrderDetails fine and do the reverse from OrderDetails. Based on

Remove # from URL in angular js SPA

帅比萌擦擦* 提交于 2019-12-25 08:38:00
问题 I have done, a lot of research on this, I will try my best to explain the detail code bit wise, I am creating an application using angular js with web api as service, when i run the application i get the # in URL. In order to remove the # from the URL, we need to add the below like in angular config, almost all suggested to add, $locationProvider.html5Mode(true); so i have added like this, angular.module('myapp', ['ui.router']) .config([......., '$locationProvider', function (.......,

Strict mapping in web Web API (Over-Posting)

江枫思渺然 提交于 2019-12-25 07:41:51
问题 I just realized that the mapping between the JSON send from a query and my API is not strict. I give you more explanations: Here is my C# POCO public partial class AddressDto { public string AddrId { get; set; } public string Addr1 { get; set; } public string Addr2 { get; set; } public string PostalCode { get; set; } public string City { get; set; } public string Country { get; set; } } And the REST JSON query PUT http://Localhost:55328/api/ClientAddr/ADD-2059-S002 HTTP/1.1 content-type:

How to prevent or allow json serialization of a property from breeze controller

邮差的信 提交于 2019-12-25 07:16:27
问题 So it happens that you can prevent breeze json serialization of some properties using data annotations on your model by like this(well if you are using EF6 with JSON.NET on the backend)... [Table("Project")] public partial class Project { public Project() { } public int id { get; set; } [JsonIgnore] public bool NoLongerExist { get; set; } } By doing so the property becomes invisible on this endpoint used by breeze public IQueryable<Project> Projects() { return _db.Context.Projects.Where(o =>