Wednesday, July 08, 2009

Forms Authentication with LDAP provider in Sharepoint - Part 2

We talked on how to configure a SharePoint site to use Forms Authentication on LDAP provider, but to complete the scenario we have to update the UI of the login page, this will work the same if any other forms authentication providers will be used.

Once the authentication provider is changed from the central administration the web.config file will be also updated as:

<authentication mode="Forms">
<forms loginUrl="~/layouts/ login.aspx" />
</authentication>

Where the login.aspx file is the default login page for SharePoint and you can go to C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS and update the login.aspx directly in this path, or make a copy from this page to any folder under your application ex. In a folder named login, you may also need to update the master page that this page is using, you can do this, by coping the new master page to the same folder, or copy simple.master from the same path and update it.

To change the master page that the login.aspx page use you can type:

<script runat="server">
void page_PreInit(object sender, EventArgs e)
{
this.Page.MasterPageFile = "~/login/mymasterpage.master";
}
</script>

This will update the master page on the fly as you can't just update the masterpage path from the aspx page.

Also, you may need to add StyleSheet file and some images to be displayed in this login page, and you can’t reference any file stored in the SharePoint libraries and you have to be authenticated first, so you can add a web.config file in the same folder that just have:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<configuration>
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</configuration>

This will allow the anonymous user (till now) to be able to request the css, js and images.

No comments:

How to Install and Use RTSP Simple Server

  How to Install and Use RTSP Simple Server   1.   Create a folder to store the app mkdir /etc/rtsp-server cd /etc/rtsp-server   2.  Downloa...