How do you return 403 Forbidden from controller method in WEB API 2?
Inside my method I want to do something like this:if (...) return Request.CreateErrorResponse(HttpStatusCode.Forbidden, "RFID is disabled for this site.");but I get error "cannot impilicitly conver...
View ArticleOData manual batch request
HiI want to perform a manual OData batch query, like this simple example that contains two GET queries:POST /service/$batch HTTP/1.1 Host: host Content-Type: multipart/mixed;...
View ArticleHow do you pass a SSRS rdl parameter to a Web API?
Hopefully, someone can help!In a browser, I understand that to get all 3 products, I would type this URL: http://ssrswebapi.softwaredevelopmentcorner.com/api/productsTo get product Id 1, I would type...
View ArticleWEB API for a Newbie
I am trying to do something I would have though was dead simple. Well apparently not judging from all of the mishmash of code out there. Here is what I am trying to accomplish.1. I want to build an...
View ArticleMetadata and contained entities
I'm hoping someone here can help settle a matter. I've been searching for a definitive answer for a while and have come up empty.We're building an OData Web API and a question has come up around the...
View ArticleWeb Api authentication quesitons
Hi, I'm using VS2013, asp.net and C#I want to create a Web Api project and add it on to a solution. The Change Authentication comes up with several options but under the Organization Account, why I...
View ArticleHow to Enhance Web API Endpoints with HttpResponseMessage ?
I've successfully built an OWIN-based Web API using C#. However, currently the endpoints just return data directly - ie. a string, a List of files, etc.I'd like to enhance them to return...
View ArticleCustom authorize and JSON body content question
Here is my web service ......[Route("GetTodaysTimecard")][HttpPost] public HttpResponseMessage GetTodaysTimecard(DeviceInfo deviceInfo) {}DeviceInfo is a class so I can add and remove properties and...
View ArticleConfirming Gzip in both directions ...
This may be a silly question but how do I confirm that the data is being received and transmitted in a Gzipped format?Is this affected by using HTTPS ?Thanks
View ArticleHow to revoke access token in OAuth2
Hi,I want to revoke access token when user logout.How can i do that ?Thank you.
View ArticleOWIN + Microsoft Unity container
I Use JMeter to make load to my WebApi. 100 user + 4000 loop for every user.Simple OWIN: avg 5-10ms, max response 200 ms OWIN +Microsoft Unity container: avg 15 ms, max response 9000ms. I have OWIN...
View ArticleHow to OAuth2 in third party workfront API ( Not social media like...
I am developing third party application work front.Work front support the client ID ,Client secret , token generate URL , .How to write a function for generate a token in a azure VM
View ArticleCreate REST API using POST and Call that API from outside by passing...
Hello,I am trying to create RESTfull API for Android in .NET. I need help on the below things:1. How to create a RESTfull API in ASP.NET?2. How to call that API from Android or 3rd party by passing the...
View ArticleJson Serialization
Hi,I have the following config in my sample project and i am using Oauth2.public static void Register(HttpConfiguration config) { config.SuppressDefaultHostAuthentication(); config.Filters.Add(new...
View ArticleLimit Request Processing Time
Hello, I have a Web API that was really slow this morning. Upon investigating, I found in the Worker Processes of IIS that a few processes were taking an excessive amount of time. I think I know the...
View ArticleSeeking Help With Using XUnit and Moq to Test an OWIN Web API Endpoint
I'm fairly new to writing Unit Tests and am challenged to find a solution to what I think should be something easy. I've successfully built an ASP.NET Web API that uses the OWIN hosting approach. My...
View ArticleRegister function to use existing sql database web api2
How do i get the register function of web api 2 not to use the local app data database is there a way to add my local sql database the tables that is required.Regards
View ArticleRemove backslash from the json data
I want to remove the backslash from the return json data{"JSONDataResult":"{\"UserName\":\"Sudhir\",\"Password\":\"******\",\"Email\":\"sudhir.bharti@hotmail.com\"}"}here is my api...
View ArticleWhat is the use of Role and Name in the Authorize attribute I'm Asp.net webapi
Hello, Could you please share a sample how can we make use of Role and user while making a request from browser or fiddler. I see some samples where people use authorization headers with base64...
View ArticleCan a Web Api be tested with Moq?
I'm building an API that will interact with LibGit2Sharp. I had several endpoints quickly up & running but then was faced with the requirement of writing tests for them, something I don't have a...
View Article