tag:blogger.com,1999:blog-5151962190898355461.comments2022-12-09T11:17:07.564+01:00Creating SoftwareUnknownnoreply@blogger.comBlogger14125tag:blogger.com,1999:blog-5151962190898355461.post-830952349693376082011-08-31T23:01:51.000+02:002011-08-31T23:01:51.000+02:00Hello Peter,Thanks for this very well explained po...Hello Peter,<br>Thanks for this very well explained post. I'm trying to get this to work with a MVC3 application but the httpcontext.current.user gets reset to the default System.Web.Security.RolePrincipal inmediately when I hit the controller so it fails with an unable to cast exception. I checked that the code in the global.asax is run but it still fails. I get it to work by placing the code from the application_authenticaterequest in the constructor of the controller. While it works doesn't seem like an ideal solution, plus I have several controllers. Any idea what I may be missing? thanks a lot.<br>Davidnoreply@blogger.comtag:blogger.com,1999:blog-5151962190898355461.post-87453838641168601522011-03-23T21:27:06.000+01:002011-03-23T21:27:06.000+01:00okay, now i understand. The Application_Authentica...okay, now i understand. The Application_AuthenticateRequest executes more than once.<br>Vinicius Gamanoreply@blogger.comtag:blogger.com,1999:blog-5151962190898355461.post-90902397678436935432011-03-23T20:50:08.000+01:002011-03-23T20:50:08.000+01:00hi @peter, i got an question. This info that you p...hi @peter, i got an question. This info that you put in cache is really necessary? I can't see where do you can use it.<br>thx<br>Vinicius Gamanoreply@blogger.comtag:blogger.com,1999:blog-5151962190898355461.post-31638509441251622682011-03-22T17:17:42.000+01:002011-03-22T17:17:42.000+01:00@bkreegerUsing the example in the post, you will a...@bkreeger<br>Using the example in the post, you will always be able to access (MyPrincipal)HttpContext.Current.User, or in MVC more prefferably (MyPrincipal) ControllerContext.HttpContext.User.<br>@stefan<br>It's your custom class that creates your custom principal with, say, some application-specific properties, associations to related domain model objects, etc.<br>Peter Ravnholthttp://blog.codevelop.dk/noreply@blogger.comtag:blogger.com,1999:blog-5151962190898355461.post-25922526640353553072011-03-22T16:34:27.000+01:002011-03-22T16:34:27.000+01:00What is MyBusinessLayerSecurityClass???I try to im...What is MyBusinessLayerSecurityClass???<br>I try to implement this Principal in my asp.net MVC 2 application<br>stefannoreply@blogger.comtag:blogger.com,1999:blog-5151962190898355461.post-63908379183925721362011-01-17T21:49:46.000+01:002011-01-17T21:49:46.000+01:00Is there an easy way to make each of these propert...Is there an easy way to make each of these properties available to every single view rendered by WebForms, or say, Razor templates in ASP.NET?<br>bkreegerhttp://benkreeger.com/noreply@blogger.comtag:blogger.com,1999:blog-5151962190898355461.post-79664873763835280682009-05-20T15:52:50.000+02:002009-05-20T15:52:50.000+02:00Nice example. However there is a small error in yo...Nice example. However there is a small error in your principal. The field someCustomProperty should have been someCustomProperty1.<br>Jan Ehlersnoreply@blogger.comtag:blogger.com,1999:blog-5151962190898355461.post-31886950987741904462009-02-03T22:07:28.000+01:002009-02-03T22:07:28.000+01:00Clever construction, Peter!Good work.Clever construction, Peter!<br>Good work.<br>Claus Konradhttp://www.clauskonrad.net/noreply@blogger.comtag:blogger.com,1999:blog-5151962190898355461.post-90692420046885774572008-09-02T17:19:01.000+02:002008-09-02T17:19:01.000+02:00Excellent idea, just one thing to note, inFormSave...Excellent idea, just one thing to note, in<br>FormSaverHttpModule.context_BeginRequest<br>it may be better to have<br>context.Response.Redirect("~/Timeouts/FormStateRestore.aspx?ReturnUrl=" + HttpUtility.UrlPathEncode(context.Request.RawUrl));<br>(UrlEncode replaced by UrlPathEncode to preseve slashes)<br>Michael Capoccinoreply@blogger.comtag:blogger.com,1999:blog-5151962190898355461.post-85745596487620653772008-09-07T01:35:14.000+02:002008-09-07T01:35:14.000+02:00Geek! :-)Geek! :-)<br>Jan Eliasenhttp://www.eliasen.dk/noreply@blogger.comtag:blogger.com,1999:blog-5151962190898355461.post-81274978109002671042008-11-06T02:02:31.000+01:002008-11-06T02:02:31.000+01:00I'd switch Acrobat Reader for Foxit Reader any...I'd switch Acrobat Reader for Foxit Reader any day: http://www.foxitsoftware.com/pdf/rd_intro.php<br>Mark S. Rasmussenhttp://www.improve.dk/noreply@blogger.comtag:blogger.com,1999:blog-5151962190898355461.post-68634360145337504852008-10-22T17:05:11.000+02:002008-10-22T17:05:11.000+02:00Arr, you are right... Actually I abandoned Resharp...Arr, you are right... Actually I abandoned Resharper some versions ago, but I will try it out again right away. Reflector: Not on my every day tool-list, but I use it regularly.<br>Peter Ravnholthttp://www.codevelop.dk/noreply@blogger.comtag:blogger.com,1999:blog-5151962190898355461.post-91310403313401053192008-10-21T14:46:15.000+02:002008-10-21T14:46:15.000+02:00i am surprised that i don't see resharper or r...i am surprised that i don't see resharper or reflector on your list<br>klaus hebsgaardhttp://khenbie.dk/noreply@blogger.comtag:blogger.com,1999:blog-5151962190898355461.post-73052168120352749282008-12-11T03:29:31.000+01:002008-12-11T03:29:31.000+01:00Good tip peter. Saved me a load of troubleGood tip peter. Saved me a load of trouble<br>Mac Nawaznoreply@blogger.com