cassette icon indicating copy to clipboard operation
cassette copied to clipboard

Anonymous Access Throwing Exception - Owin/MVC5

Open mickdelaney opened this issue 11 years ago • 3 comments
trafficstars

Hi,

I'm getting an exception where the page is not authenticated, e.g. login pages etc. Seems to be related to Output caching needing an IPrincipal.

in web.config i have:

<httpCookies httpOnlyCookies="true" />
<authentication mode="None" />
<anonymousIdentification enabled="true" />

URL: /cassette.axd User: Exception: Object reference not set to an instance of an object;
at System.Web.HttpContext.RequestRequiresAuthorization();
at System.Web.Caching.OutputCacheModule.OnLeave(Object source, EventArgs eventArgs);
at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute();
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously); System.Web.HttpContext;RequestRequiresAuthorization;

NOTE:

It only happens when the query string version hash is appended. e.g. /cassette.axd/asset/client/jquery.js?2fc3a5a5b9fb05677e50fc3ca1fb88b4acc038cb

i.e. if i manually request /cassette.axd/asset/client/jquery.js it all works fine.

Anyone else had this??

mickdelaney avatar Jan 05 '14 13:01 mickdelaney

I've not tried Cassette in MVC5 at all yet, so there's not much I can suggest right now. You'll need to dig into https://github.com/andrewdavey/cassette/blob/master/src/Cassette.Aspnet/AssetRequestHandler.cs I think.

andrewdavey avatar Jan 06 '14 10:01 andrewdavey

cheers. i'll have a look.

mickdelaney avatar Jan 06 '14 11:01 mickdelaney

any news about this issue?

Rana11 avatar Jan 25 '16 13:01 Rana11