Tuesday, August 4, 2009

Applying Theme to Login.aspx in Sharepoint

Ever wondered how to have the look and feel of Sharepoint login page based on the theme applied on site collection? I never thought about the importance of that until there was a site collection which had theme applied and forms based authentication enabled. The site was looking beautiful with the theme applied, application and layout pages were having the same look and feel, but when the sign in was clicked all went to the same sharepoint blue look and feel … hmmm it's not that good to see that blue color from a rich theme applied website isn't ?

Applying a theme will change the look and feel of pages which come from _layouts folder as well as the application pages. Login.aspx also resides under _layouts folder in the 12 Hive, but why it is not inheriting the theme?, this was the first question came in to my mind. So on investigating more in the login.aspx and its associated master page simple.master I found a workaround and that is as below.

  1. If the login.aspx is closely looked, we can see that it uses the simple.master page and it misses the tag to inherit the theme (<SharePoint:Theme runat="server"/>).
  2. A new master page named login.master was created by taking a copy of simple.master.
  3. Added the theme server tag under the head html tag.
    1. <HEAD runat="server">

      ….

      <SharePoint:Theme runat="server"/>

      ….

        </HEAD>

  1. Saved the login.master and copied it to LAYOUTS Folder.
  2. Updated the login.aspx to use the login.master.
    1. <%@ Page Language="C#" Inherits="Microsoft.SharePoint.ApplicationPages.LoginPage" MasterPageFile="~/_layouts/login.master" %>
  3. That's it. Go to IE and refresh the login page to see login page with theme applied.
  4. Enjoy !!

 

8 comments:

Gunjan said...

I followed the steps and it's not working for our environment. We are using WSS 3.0 SP2. Do you have to enable anonymous access? We are using FBA authentication w/out anonymous enabled.

Aj said...

I am using FBA only. What is the site collection structure? Are you trying with the site collection which has the /sites/ in it ?

Gary said...

I've followed the steps as well and it's not working too.
I have FBA enabled and anonymous access disabled, WSS 3.0 SP2. I'm guessing that unauthenticated users at the log in page do not have access to themes folder. Because when i try to sign in as different user, i do see the themes applied nicely. But a fresh log in attempt shows me the default blue and yellow theme. Any help?

Gary said...

I've tried your implementation but i'm only able to see the themes only when i sign in as different user. Are there any other configuration changes that you have made?

Aj said...

Hi Granaldo, sorry for the delayed reply. I have been busy with relocating to another country with a job change, so didn't had time to update the blog.

As far as I see, there is no other configuration needed. Unauthenticated users will be having access to the login folder unless the default folder security have been altered.

Jalal Mankach said...

that not work sorry, i have WSS 3.0 MOSS 2007?? i restar iis 6 but this solution missing somethig i don't know.

Aj said...

Hi Jalal,

If you notice the url, to where the login.aspx is redirected, then the current context will be the root site collection, and the works based on current context web's theme, and since it is always redirected to http://servername/_layouts/login.aspx, please apply theme to root site and have a try. Hope this helps.

See the link to have a working theme applied login.aspx

Click to view image

Aj said...
This comment has been removed by the author.