|
.net
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
WebPartManager: disable Personalization and still use WebPartManger.AddWebPart()Is this possible? My entire web site is being built dynamically using
WebPart's and a lot of it will be anonymous. How do I load these parts dynamically using WebPartManager.AddWebPart() and not use Personalization. I think I am saying this correctly. When I disable Personalization in the WebPartManager tag and use AddWebPart(), I am told Personalization is not enabled.... There is also a defaut Authorization entry in IIS specifying all users, all verbs. What else am I missing? Please say so if you need code snippets. Or you can point me to an article. From what I've been reading, I cannot find what I need. I think it is not possible to enable design mode for Webpartmanager control.
I had same problem and I googled it but could not find a proper solution. Also on ASP.NET tutorial, they said that you must login to switch to the design mode. Thanks Show quote "SlimFlem" <slimf***@gmail.com> wrote in message news:1136572820.472355.139560@g44g2000cwa.googlegroups.com... > Is this possible? My entire web site is being built dynamically using > WebPart's and a lot of it will be anonymous. How do I load these parts > dynamically using WebPartManager.AddWebPart() and not use > Personalization. I think I am saying this correctly. When I disable > Personalization in the WebPartManager tag and use AddWebPart(), I am > told Personalization is not enabled.... > > There is also a defaut Authorization entry in IIS specifying all users, > all verbs. What else am I missing? > > Please say so if you need code snippets. Or you can point me to an > article. From what I've been reading, I cannot find what I need. > I found this approach very interesting if you don't require uses to login to
your site. http://www.codeproject.com/aspnet/anonywebparts.asp Show quote "SlimFlem" wrote: > Is this possible? My entire web site is being built dynamically using > WebPart's and a lot of it will be anonymous. How do I load these parts > dynamically using WebPartManager.AddWebPart() and not use > Personalization. I think I am saying this correctly. When I disable > Personalization in the WebPartManager tag and use AddWebPart(), I am > told Personalization is not enabled.... > > There is also a defaut Authorization entry in IIS specifying all users, > all verbs. What else am I missing? > > Please say so if you need code snippets. Or you can point me to an > article. From what I've been reading, I cannot find what I need. > > glad to assist.
Show quote "SlimFlem" wrote: > This is exactly what I need, thank you very much for the link. =) > > Hi maybe you can help with one more thing. I have implemented the
Cookie code in the article, but my Page.User object is always null and I don't understand why. I haven't done a lot with Forms Authentication before, but it was my understanding the when placing the .ASPXAUTH cookie in the Cookies collection, this essentially makes the user IsAuthenticated = true and the User object not null. What am I missing. My code is the C# version of the code in the article. I am doing this in an HttpModule and not in Page_Load(). I have tried both but it makes no difference. Is there something else I should be doing to get the User object set and IsAuthenticated to be true? Thanks. The only difference between the article and my code is that I have an
IHttpModule that runs first to perform some Url remapping, or not. If my Url is remapped, I do a Server.Transfer to avoid a duplicate request, otherwise, the module does nothing and the request happens as normal. The module that performs the FormsAuthentication and creates the HttpCookie runs first followed by the Url remapping IHttpModule. Is it required to do a Response.Redirect() so the .ASPXAUTH cookie is recognized and the User object is set? Will a Server.Transfer() break FormsAuthentication? When getting into
the aspx that requires authentication, I see the Cookies are created, but User is null. Also, I have merged the authenticaiton code in the branch of the IHttpModule that performs the potential Url remapping and I do the auth stuff in that branch. Any info is appreciated. Here is my code to create the ticket/cookie: ============================================== void CreateUserCookie(string UserID) { // create the new ticket FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, UserID, DateTime.Now, DateTime.Now.AddMinutes(40), false, "roles", FormsAuthentication.FormsCookiePath); // encrypt the ticket string encryptedTicket = FormsAuthentication.Encrypt(ticket); // create an authentication cookie HttpCookie ticketCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket); _context.Response.Cookies.Add(ticketCookie); } ===== After this, I also do a Response.Redirect back to the same Url, with this being skipped this time by an IF, then Server.Transfer to the generic aspx loader page that uses WebPart classes dynamically. |
|||||||||||||||||||||||