asp.net-web-api

downloading file (pdf/image) from using Microsoft bot framework

扶醉桌前 提交于 2020-01-02 17:19:26
问题 I wanted to download document/image ( Document/image is on internet and I am giving path of it). But it ins not working.. How ever if I just comment the attachment part, I am able to get "Hi" from BOT. Lets have the controller like this [BotAuthentication] public class MessagesController : ApiController { /// <summary> /// POST: api/Messages /// Receive a message from a user and reply to it /// </summary> public async Task<HttpResponseMessage> Post([FromBody]Activity activity) {

MapODataRoute and ODataQueryOptions

雨燕双飞 提交于 2020-01-02 15:38:57
问题 Im building a WebAPI OData solution that handles untyped entity objects, as described in this excellent post. Like that post, I define my EdmModel upfront, and use the MapODataRoute method and pass in the model to use: config.Routes.MapODataRoute("odata", "odata", ModelBuilder.GetEdmModel()); However, this does not seem to work with ODataQueryOptions parameter in my methods: Get(ODataQueryOptions query) { } It gives the following error: The given model does not contain the type 'System.Web

MapODataRoute and ODataQueryOptions

蓝咒 提交于 2020-01-02 15:38:50
问题 Im building a WebAPI OData solution that handles untyped entity objects, as described in this excellent post. Like that post, I define my EdmModel upfront, and use the MapODataRoute method and pass in the model to use: config.Routes.MapODataRoute("odata", "odata", ModelBuilder.GetEdmModel()); However, this does not seem to work with ODataQueryOptions parameter in my methods: Get(ODataQueryOptions query) { } It gives the following error: The given model does not contain the type 'System.Web

ASP.NET WebAPI Creating one-level JSON

独自空忆成欢 提交于 2020-01-02 15:26:12
问题 There are many related entities in Domain assembly. For example People that has navigation properties (Level1) to FamilyRelations , Houses and Persons . Beside this the Houses has own nav.prop (Level2) to Address and Address (Level3) has to City , Street ... etc. When I set LazyLoadingEnabled to true then I'm getting JSON (on the left side in screen) with all related entities. How can I get only one level of nesting (as on the right side in scree) or set other levels to NULL value (because I

ASP.NET WebAPI Creating one-level JSON

徘徊边缘 提交于 2020-01-02 15:25:48
问题 There are many related entities in Domain assembly. For example People that has navigation properties (Level1) to FamilyRelations , Houses and Persons . Beside this the Houses has own nav.prop (Level2) to Address and Address (Level3) has to City , Street ... etc. When I set LazyLoadingEnabled to true then I'm getting JSON (on the left side in screen) with all related entities. How can I get only one level of nesting (as on the right side in scree) or set other levels to NULL value (because I

AngularJS best practice application authentication

半腔热情 提交于 2020-01-02 14:01:26
问题 I'm start building a web application where the user needs to authenticate in order to get access to different modules. I have been working with ASP.NET MVC in the past and it was quite easy using FormsAuthentication and Server Sessions so I don't have to do roundtrips to the database in order to get the user roles or any other user related data everytime I access a web method. What I have been reading, AngularJS won't work that way so there won't be any Server Session, etc.. So... In case I

Enabling WebAPI CORS for Angular 2 authentification

不问归期 提交于 2020-01-02 11:15:16
问题 I've seen a few answers on stackoverflow and I'm lost. I have webapi 2 + standalone angular 2 webapi project is from template. the only thing i've changed is that i added CORS and following line to IdentityConfig.cs > ApplicationUserManager Create() context.Response.Headers.Add("Access-Control-Allow-Origin", new[] { "http://localhost:3000" }); here I've all standard from template: [Authorize] public class ValuesController : ApiController { // GET api/values public IEnumerable<string> Get() {

Enabling WebAPI CORS for Angular 2 authentification

孤街浪徒 提交于 2020-01-02 11:15:10
问题 I've seen a few answers on stackoverflow and I'm lost. I have webapi 2 + standalone angular 2 webapi project is from template. the only thing i've changed is that i added CORS and following line to IdentityConfig.cs > ApplicationUserManager Create() context.Response.Headers.Add("Access-Control-Allow-Origin", new[] { "http://localhost:3000" }); here I've all standard from template: [Authorize] public class ValuesController : ApiController { // GET api/values public IEnumerable<string> Get() {

SignalR Authorization using Web API Token

与世无争的帅哥 提交于 2020-01-02 10:28:06
问题 I am attempting to authorize SignalR requests exactly using the sample project here AngularJS Authentication based on this project AngularJS Authentication using web tokens. The problem I am having is, to use SignalR authorization, I had to override the SignalR AuthorizeAttribute class as below: public class QueryStringBearerAuthorizeAttribute : AuthorizeAttribute { public override bool AuthorizeHubConnection(HubDescriptor hubDescriptor, IRequest request) { var token = request.QueryString.Get

Why does WebApi fail to bind a System.Version parameter?

好久不见. 提交于 2020-01-02 09:58:33
问题 UPDATE : solved! Nothing to see here, please move on :-) I have an ApiController method that takes a System.Version parameter. The parameter is passed in the request body, as JSON. This is what gets sent: { "Major": 0, "Minor": 7, "Build": 0, "Revision": 0, "MajorRevision": 0, "MinorRevision": 0 } The routing works - my method is being called - but the parameter has an empty Version object (all values zero). Why? Here's the declaration of the controller method: // POST api/service/details