clovernews

Hi there,

I'm developing a WCM website in MOSS and so have two entry points to the website - one web app for internal use to edit the site (i.e. you have to authenticate), and one for the website (i.e. anonymous access).

I've created a master page which obviously has to contain controls that allow users to log in and author content. However since the same master page is used for both web apps, I need to hide those controls when the site's being accessed anonymously. I don't want there to be a 'Sign in' link when viewed anonymously.

I've written a simple piece of code to test whether the site is being requested internally or externally (anonymously), and want to use that logic to hide these controls. I've put the controls on a panel and that gets set to Visible=false when the site is accessed externally - however I'm still getting a Windows authentication login prompt. I currently have the code in the Page_Load method - my current thoughts are that this is the wrong method to be doing this in but I haven't got further than that yet.

I've made sure the site is set up correctly for anonymous access by setting the site to use BlueBand.master and can access that fine anonymously.

I'd really appreciate it if someone had some ideas on what I need to do to get this to work.

Thanks,
clover


Re: SharePoint - Development and Programming Hiding sign in control from anonymous users

Praveen battula

hi,
i m also facing the same problem.
how to disable the sign in link for anonymous users.
if u get the solution, please tell me.

thanks





Re: SharePoint - Development and Programming Hiding sign in control from anonymous users

clovernews

Will do. My problem's not so much how to hide the sign in link, as why I'm getting the authentication prompt using my master page, but when I switch to BlueBand I don't (hence I know anonymous access is configured correctly).

I've just seen this post in another forum, maybe it'll help you - sounds a lot better than my panel idea anyways although I thought I'd tried something similar and couldn't get it to work... but as I say my main problem is getting the blasted login prompt to not show, so once I've figured that out hopefully the below will be all I need to do to complete the task:

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1819595&SiteID=1




Re: SharePoint - Development and Programming Hiding sign in control from anonymous users

clovernews

Ah - solved my problem with the use of a handy tool:

http://blog.thekid.me.uk/archive/2007/02/20/anonymous-sharepoint-publishing-site-forcing-login.aspx

I did in fact still have unpublished items on my site, despite all my careful checking, and now can access my site anonymously.

As for hiding the sign in link, do what the post I pointed to earlier suggested, i.e. in the masterpage <head> put:

<script type="text/c#" runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (Page.User.Identity.IsAuthenticated)
{
signIn.Visible = true;
}
}
</script>

And then within <body> etc put:

<wssuc:Welcome id="signIn" runat="server" Visible="false"/>

MUCH easier than I'd originally thought so do use said 'handy tool' to check for unpublished items first!

clover




Re: SharePoint - Development and Programming Hiding sign in control from anonymous users

phydroxide

CloverNews:

I'm glad you discovered it was unpublished Items. I always have the issue with my page layouts not being published. The style library and the master page gallery don't appear to inherit the same anonymous permissions as the rest of the site. In any event, even when they are set up correctly and you check in your items, you still have to publish a major version or it makes you sign in. A good way to check this is to visit the Pages/Forms/AllItems.aspx page first. If anonymous access is enabled you can get to this view without logging in. then when you click on the page in question, and it asks you to authenticate you know for sure there are some unpublished files it is dependant on.

We are looking for a solution also for the sign in page. I started by trying to convince our customer that it was just a new mindset that every page will need to have a login link, but now I agree that would be excessively confusing for visitors. Someone on the sharepoint discussion group suggested using content deployment with a master page that didn't have the sign-in button and contributing content against a master page that does. To me that is a little overkill for what we are trying to do.

I liked your solution, but the one described in the website referenced below uses Security Trim, which I prefer over a script, only because I am assuming it is a more standard control versus your solution which overrides a standard function -- Perhaps I don't fully understand.

http://mindsharpblogs.com/matthew/archive/2007/06/02/1855.aspx

Here is a link that lists the PermissionsString properties for the SPSecurityTrimmed Control

http://msdn2.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.spsecuritytrimmedcontrol.permissionsstring.aspx






Re: SharePoint - Development and Programming Hiding sign in control from anonymous users

clovernews

Hi phydroxide,

I needed the ability to present some users with a sign in link and to hide it from others on one master page - i.e. I have two different entry points to the same content, one for visitors to the website and one for content managers of the website. I had seen Matthew's blog but didn't want to have to direct the content managers to a system page in order to log in (seems like a bit of an unecessary workaround for an end user to have to do), I wanted them to be able to log in from pages on the website.

As for 'overriding a standard function', I'm not - Page_Load is just an event handler.

clovernews






Re: SharePoint - Development and Programming Hiding sign in control from anonymous users

phydroxide

So how do you get them to log in

Using the same master page we just created a Welcome page called Login.Aspx which had tighter security settings. When users visit this page they are forced to log in.

I guess, how do you present some users with the sign in link I don't quite understand.






Re: SharePoint - Development and Programming Hiding sign in control from anonymous users

phydroxide

I assume you use content deployment to publish content to the anonymous web app






Re: SharePoint - Development and Programming Hiding sign in control from anonymous users

clovernews

Hello,

What I meant by two entry points to the same content is that I've extended my web app - so I've got two, each for a different zone, so they can have different settings (i.e. different URLs, different authentication mechanisms - one anonymous, one Windows auth, etc), but both point to the same content database. This model means that content editors can log in to add/update content, and once it's published that content is viewable from the anonymous entry point, no content deployment required.

>> I guess, how do you present some users with the sign in link I don't quite understand.

Using the code I gave a few messages above, since one of the web apps is anonymous and the other Windows authentication, it determines whether or not to show the sign in link.

HTH,
clover