开发者

isAuthenticated not recognized on rewritten pages

I'm using the UrlRewriting module on my site and I can't seem to get HttpContext.Current.Request.IsAuthenticated to return "true" on any rewritten pages.

If I go to my home page (http://localhost/default.aspx) I get "true", but if I go to something like (http://localhost/contactus) I am always getting "false".

why would this be?

also, for a direct example, I have an edit bar that is supposed to appear to anyone who is authenticated. The if statement fires in the Page_Load method

If HttpContext.Current.Request.IsAuthenticated Then _ 
Me.FindControl("EditBar").Visible = True

I have also tried putting this in the page load event

Response.Write(HttpContext.Current.Request.IsAuthenticated.ToString)

Every page that is rewritten开发者_开发百科 says "False" where pages that are not rewritten say "True".


I had a similar issue. Does adding the following to your web.config fix your problem?

<modules runAllManagedModulesForAllRequests="true">


Hmm, wherever the code in my question DIDN'T work, then this code did.

User.Identity.IsAuthenticated
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜