473,406 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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.

Jan 7 '06 #1
9 3371
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
"SlimFlem" <sl******@gmail.com> wrote in message
news:11**********************@g44g2000cwa.googlegr oups.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.

Jan 7 '06 #2
I found this approach very interesting if you don't require uses to login to
your site.

http://www.codeproject.com/aspnet/anonywebparts.asp

"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.

Jan 7 '06 #3
Thank you! I will look this over. Thanks for the response.

Jan 9 '06 #4
This is exactly what I need, thank you very much for the link. =)

Jan 9 '06 #5
glad to assist.

"SlimFlem" wrote:
This is exactly what I need, thank you very much for the link. =)

Jan 9 '06 #6
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.

Jan 9 '06 #7
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?

Jan 9 '06 #8
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.

Jan 9 '06 #9
I got this working. I had to create a FormsIdentity based on the
FormsAuthenticationTicket then use that to create a GenericPrincipal
and attach it to Context.User.

Jan 9 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Shaun | last post by:
I am trying to import a webpart that has been developed as a standalone project - single webpart class in an assembly. I've read up on the web (Fredrik Normén's Blog etc) that it is possible to...
0
by: Danny Tuppeny | last post by:
Hi all, I'm after some advice... I'm building a website which will have a login etc.. The Personalization in asp.net 2 stuff looks like it'll save me some time (login controls etc.), however,...
0
by: CBretana | last post by:
Is it possible to programmatically control the WebPartManager without being on a web page? I need to write a C# console app that will cycle through a set of objects and for each one, generate (for...
3
by: SlimFlem | last post by:
I am new to the WebPartManager stuff and am still learning how to set this up properly. I am creating instances of WebPart classes from loaded DLLs and add them to the Page's WebPartManager. If I...
1
by: Bill Mild | last post by:
Has anyone gotten the new Portal Framework in ASP.NET 2.0 to work in conjunction with <anonymousIdentification enabled="true />? I get this error... Personalization is not enabled and/or...
1
by: Prashant Majhwar | last post by:
I have created sample web Application. On the default page I drop webpartmanager control and then create a table and place webpartzones. Now when i am running it in development mode ...everything...
0
by: milmus tender | last post by:
Hi, I hope, that I post in the right newsgroup. Please tell me if not. I use the WebPartManager technology of ASP.NET 2.0 without sharepoint. I want to set per server side code a webpart as...
1
by: Ya Ya | last post by:
I am using the personalization feature in asp.net 2.0 I am storing the phone number for each user. When a certain user enters his phone number I would like to check if another user already...
1
by: john20 | last post by:
Hi All, I am trying to use webpart in my page for that i am putting webpartmanager and webpartzone. but as soon as i am putting webpartmanger in the page it is giving me below error, let me...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.