asp.net-web-api

ASP.NET webAPI <--> Dojo uploader response format is wrong

本秂侑毒 提交于 2019-12-25 14:46:15
问题 i have a problem with uploading documents with dojo. I´m using the dojox/form/Uploader to upload a file withiframe mode. After uploading there is a response from the server in a special format. The uploader only works when i send it like this: Server: '{"name":"file.png","file":"filename","type":"form-data"}' But the answer is: Client: "'{\"name\":\"file.png\",\"file\":\"filename\",\"type\":\"form-data\"}'" So i think there are two possible ways to solve this problem: A. Fixing it on the

How to $select on OData Open Data Type? Query not valid error

試著忘記壹切 提交于 2019-12-25 13:46:53
问题 I'm serving an entity that has a Open Data Type of type: IDictionary I'm not able to use the $select keyword to select the dynamic data I have in that dictionary. I have other static atributtes that $select just fine. The error I'm getting is the following: { "error": { "code": "", "message": "The query specified in the URI is not valid. An identifier was expected at position 0.", "innererror": { "message": "An identifier was expected at position 0.", "type": "Microsoft.OData.ODataException",

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

Web api route values is empty on action executes filter

旧巷老猫 提交于 2019-12-25 12:53:07
问题 I am using a custom action filter on my controller action. My controller action is like this: [HttpPost] [Route("listener")] [MyAttr] public IHttpActionResult Listener([FromBody]Parameters request) { return Ok(); } I want to access Route("listener") values from action filter. public class MyAttr: ActionFilterAttribute { public async override Task OnActionExecutedAsync(HttpActionExecutedContext actionExecutedContext, CancellationToken cancellationToken) { var route = actionExecutedContext

Mono mod asp server web api post method not working

心已入冬 提交于 2019-12-25 12:28:29
问题 I am trying to configure mono mod asp server for webapi. It's working fine with get method but Post method gives me strange error. What I did is I simply created webapi default application and used its default apicontroller without any modification. Get and Post api is working fine on IIS server. Tried to find the solution but got stuck very bad. Please help me out. 来源: https://stackoverflow.com/questions/34005488/mono-mod-asp-server-web-api-post-method-not-working

Mono mod asp server web api post method not working

℡╲_俬逩灬. 提交于 2019-12-25 12:28:08
问题 I am trying to configure mono mod asp server for webapi. It's working fine with get method but Post method gives me strange error. What I did is I simply created webapi default application and used its default apicontroller without any modification. Get and Post api is working fine on IIS server. Tried to find the solution but got stuck very bad. Please help me out. 来源: https://stackoverflow.com/questions/34005488/mono-mod-asp-server-web-api-post-method-not-working

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

c# error passing a string in POST from jquery to a WebAPI project method

陌路散爱 提交于 2019-12-25 12:09:56
问题 I'm doing something seemingly easy. I have a jquery function that call a WebApi project method (c# visual studio 2013). This method accept a string in input as parameter. this is my javascript code function insert() { var tag='test'; $.ajax({ type: "POST", contentType: "application/x-www-form-urlencoded" url: 'api/TAGS/InsertTAG', data: tag, success: function (msg) { $("#result").html(msg); }, error: function () { alert("fail"); } }); } WebApiConfig.cs: config.Routes.MapHttpRoute( name:

Re size image not working C# [duplicate]

我是研究僧i 提交于 2019-12-25 11:16:09
问题 This question already has answers here : Resize image proportionally with MaxHeight and MaxWidth constraints (3 answers) Closed 6 years ago . Am re sizing an image with the following code using (Image thumbnail = new Bitmap(100, 50)) { using (Bitmap source = new Bitmap(imageFile)) { using (Graphics g = Graphics.FromImage(thumbnail)) { g.CompositingQuality = CompositingQuality.HighQuality; g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.SmoothingMode = SmoothingMode.HighQuality;