Monday, December 7, 2009

Creating Custom theme in Share Point2007(MOSS 2007)

It is very easy to create custom theme for share point sites. A SharePoint site theme basically consists of three kinds of files:-

1. theme.inf

2. theme.css

3. image files.

Just follow the following steps and you will get your custom theme. Suppose your theme name is "myTheme".

1. Go to the folder "C:Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\THEMES" folder. Every Folder under this Folder defines a theme. Just make a copy of any of the the Folders and name it "myTheme". Suppose you copied BELLTOWN folder.

2. Rename BELLTOWN .INF to MYTHEME.INF. Keep in mind the uppercase thing.

3. Open MYTHEME.INF file with notepad and replace all BELLTOWN to myTheme.

4. Open "C:Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATELAYOUTS\1033\SPTHEMES.XML" file with notepad.

5. Add the following lines under tag:

< templates >
<>
myTheme< /templateid >
<>
myTheme< /displayname >
<>
myTheme< /description >
<>images/
myTheme.gif< /thumbnail >
<>images/
myTheme.gif< /preview >
< /templates >

Notice that preview and thumbnail paths are images/thghost.gif. By default, MOSS 2007 and WSS 3.0 will not have such image files.

6. Create a picture to describe your theme and store that in "C:Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\IMAGES" folder with myTheme.gif name.

7. Restart IIS.

8. Now go to Site Settings, now choose myTheme theme.

9. Now to edit this theme open SharePoint Designer 2007. Go to "File" -> "Open Site…" and type the URL of your site.

10. In the Left menu you will find a lot of Folder,find a folder named myTheme which is your custom theme.

11. Find myTh-65001.css file in this folder. This is the CSS file for your theme. Edit this according to your need.

12. There is another css file named CORE.CSS in "C:Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUT\1033\STYLES" which contains styles for all sites. You may need to override some css attributes from this file.



Friday, December 4, 2009

Using Membership Provider with security controls in ASP.NET

Membership Provider is a great feature of ASP.NET which makes user authentication jobs dramatically easier for coders. There are two different membership providers: the ActiveDirectoryMembershipProvider and the SqlMembershipProvider.
The ActiveDirectoryMembership provider uses Microsoft® Active Directory® directory service to maintain user information, while the SqlMembershipProvider stores user details in a SQL Server database.
This article is aimed to provide the minimum required steps to use Membership Provider with security controls.

First create a database which will store your user credentials. Suppose the name of the database is Credentials.

First start Visual Studio 2008 Command Prompt,assuming you are using VS2008 you will find it in All Programs>Microsoft Visual Studio 2008>Visual Studio Tools>Visual Studio 2008 Command Prompt.

Now execute the command aspnet_regsql Now you will be given a ASP.NET SQL Server Setup Wizard. You can use this tool to create/configure databases which stores information of ASP.NET application services.

If you have successfully followed the steps then check the database you provided here and you will find some new tables created in your database. So your database is ready.

Now create a web site using VS2008. We have some editing to do in the web.config file. You have to provide connection sttring,changed authentication mode to "Form" from "Windows" and then in system.web section add membership provider info.

<>
< name="ConnectionString" connectionstring="server=BDDH01-W0065\SQL2K5;database=Library;integrated security=SSPI;Trusted_Connection=Yes;">
< /connectionStrings >

and ---

< mode="Form">

and finally in system.web section

< defaultprovider="CustomMembershipProvider">
<>
< add connectionStringName="ConnectionString" name="CustomMembershipProvider"
type="System.Web.Security.SqlMembershipProvider" />
< /providers>
< /membership >



That's all. Now to check if everything is working fine go to Website menu in Visual Studio and select ASP.NET Configuration . A webpage will appear and you can configure your system here Go to Security tab,there will be a option for creating new user. Create a new user.

Now add the Login control in your webpage from Tollbox.Run the website and try to log in using the user you already have created. You can use all the other controls like CreateUserWizard etc. in the same way. Easy, huh :) :) :)

So you have managed to create the whole authentication process without any coding. This is just the beginning,there are a lot of other features available. If possible I will come with some deeper facts.