Comments (2)
yes, the SO example doesn't set the content type header correctly. Set it
to application/json or use different method of creating JSON response (i.e.
JsonResult : IHttpActionResult)
On 15 December 2013 00:25, snblackout [email protected] wrote:
Using V2 line 153 of CacheOutputAttribute.cs:
_webApiCache.Add(cachekey + Constants.ContentTypeKey,
actionExecutedContext.Response.Content.Headers.ContentType.MediaType,
cacheTime.AbsoluteExpiration, baseKey);Headers.ContentType = null.
I'm decorating my GET function like:
Public Function DoGetThis(ByVal guid As String) As HttpResponseMessage
Returning:
New HttpResponseMessage() With {.Content = New JsonContent(New With {Key
.Success = True, Key .Message = "Success", .NowPlaying = data})}data is my own business logic class.
JsonContent is from
http://stackoverflow.com/questions/14231877/how-to-return-json-object-on-web-api-controllerAm I doing something wrong?
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/51
.
from strathweb.cacheoutput.
Thank you, I just decided to ditch the JsonContent from the SO article and just did:
Return Request.CreateResponse(Of MyClass)(HttpStatusCode.OK, New MyClass())
That way your OutputCache is working fine and I can still return my own class structure back over the line.
from strathweb.cacheoutput.
Related Issues (20)
- Custom CacheKeyGenerator not being used in some cases HOT 2
- Last-Modified / If-Modified-Since / 304 support with data-based timestamp?
- Pipeline issue on my method Attributes in web Api controller
- Return 412 Precondition Failed on PUT requests
- Does not add cache header to HTTP302 redirect responses
- Servertimespam
- Add method not populated
- set up a new CI pipeline
- Custom Headers gets lost in cached server response HOT 2
- Invalidate cache for certain query strings
- Nuget hasn't been updated in a while HOT 1
- Four cache keys on one request
- Invalidate cache outside request context. HOT 1
- Cache not working after deploy to server
- It is not possible to set cache timeout in milliseconds HOT 1
- Will there be a nuget release of this .net 5 version soon? HOT 1
- Fancy a tech bump?
- Problem with registrations
- Client-cached WebAPI response doesn't update when changing users, using PerUserCacheKeyGenerator
- 📢 This repo is no longer maintained 📢
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from strathweb.cacheoutput.