Recently Viewed...

    |   Register   |   Thursday, December 04, 2008   
Sharepoint 2007 Forums
Subject: Problems with webparts when anonymous user is viewing the page.
Prev Next
You are not authorized to post a reply.

Author Messages
Tor-Øyvind
Posts:2
new to the springs
new to the springs

05/18/2007 4:26 AM  

Hello,

I have build a sharepoint 2007 site to be used as a internet site, without users needing to log in.

The problem is when I add my own webparts to a page. I get a "401 UNAUTHORIZED". I have developed the webparts in C#, and deployed them as described here:
 http://www.codeguru.com/csharp/.net/net_asp/webforms/article.php/c12293/

(However added the dll file to the GAC and not the the _app_bin directory)

Everything works fine as long as I am logged in, but they doesn't seem to work for anonymous users.

 

Any suggestions out there?

 

 

Chad
Posts:2271
river guide
river guide

05/18/2007 1:22 PM  

Ummm. Do you use any resource files?

This article does outline some great details.

A few things, there are a few ways of building an deploying web parts with a few general requirements. Typically you would want to make sure you have the .webpart file (DWP file such as name.webpart), manifest.xml file if you are building a solution, and in general the DLL). Although some of these are optional if you are just trying to deploy and get it working on a development server.

A few things to check.
1. Make sure it was signed (would have to be for you to add to the GAC anyway)
2. Make sure you have the safe control property added in the web.config file.
3. If you re-build the application and are using the GAC make sure you remove and re-add the file
4. Not that you should have to but for testing purposes you can always change the line Trust = "WSS_Minmal" to be Trust = "Full" in the web.config.

Also, at what point do you get the error? Are you able to go as the article describes to Site Settings, Web Parts, New, and does your web part show up there correctly?

Finally, I would start with a 'Hello World' within the render contents event so that you know its not directly related to any specific code you have.

-Chad

Chad
Posts:2271
river guide
river guide

05/18/2007 1:23 PM  
I just read your part again about it not working only for anonymous users (whoops ). In that case, does 'Hello World' work? It might be code specific, for example if its references a folder on your server that the permissions need to be updated on.

-Chad
Tor-Øyvind
Posts:2
new to the springs
new to the springs

05/21/2007 9:20 AM  
Thanks Chad,

The Hello World part works, I just kept adding components until it broke again. It seems like I have some problems with caching:

if ((this.PartCacheRead(Storage.Shared, this.ID) != null))
{
layoutHtml = this.PartCacheRead(Storage.Shared, this.ID).ToString();
}
else
{
layoutHtml = GetRenderItem();

this.PartCacheInvalidate(Storage.Shared, this.ID);
this.PartCacheWrite(Storage.Shared, this.ID, layoutHtml, TimeSpan.FromSeconds(_cacheTimeout));
}
You are not authorized to post a reply.
Forums > Sharepoint 2007 General Information > General Discussions > Problems with webparts when anonymous user is viewing the page.



ActiveForums 3.7
Copyright 2005 - 2008 by Data Springs, Inc.
Terms Of Use | Privacy Statement