Moss custom login page

Source: Internet
Author: User
In Microsoft sharepoint2007, form authentication is allowed, but it is boring to use the default logon page after form authentication. If you only use SharePoint internally, it doesn't matter if you log on to the page, because you may be using Windows authentication at this time (Windows Authentication does not apply to the form login page ). Form authentication is often used for Internet-oriented or customer-oriented websites. In this case, the website image is very important. In order to make SharePoint sites have a good interaction with users, it can provide a good interface for users. The template page is very important. However, when you submit a template page to a Sharepoint website or modify a team site website, you will soon find that you have not modified it to the logon page. In this article, let's take a look at how to modify the logon screen.

If you want to know how to implement form authentication in sharepoint2007, please view authentication Forms authentication in SharePoint 2007.

Where is the login. aspx file stored?

After using form authentication, once you access a protected page, Sharepoint redirects you to the login page (1 ). On the login page, view the address bar of the browser and you will find that the login. ASPX page is placed in the _ layouts folder. However, there is no folder named _ layouts in the local folder where you place the SharePoint application. This may not be surprising for many people, because many of the trusted poin pages that we can access do not actually exist in the system. However, open the IIS manager and we can see on the SharePoint website that the _ layouts folder is actually a virtual directory, this virtual directory points to a real folder on the server. The path of this folder is generally as follows (as long as you have installed Sharepoint to the default path ):

C: Program filescommon filesmicrosoft sharedweb server extension12templatelayouts

The applications and system pages used by the SharePoint site are stored in the layouts folder. Upload a file to the SharePoint site. You will use the upload. ASPX page in the layouts folder. You can also view the list of users allowed to access the site on the people. ASPX page in the layouts folder. Similarly, if you want to log on to the website, you must access the login. ASPX page. In the layouts folder, there are a total of 400 page files, each of which has its unique functions and functions. Therefore, it is impossible to understand them one by one.

Global effect of modifying files in the _ layouts folder

After finding the location of the application system file, you may be eager to open an editor and plan to modify the file. However, you may need to figure out the impact of your modifications before editing. Remember that the _ layouts folder in the SharePoint site is a virtual directory pointing to the path "C: Program filescommon filesmicrosoft sharedweb server extension12templatelayouts? Yes, the _ layouts directory of all SharePoint sites created on the same server is set in this way. This means that any changes you make to the _ layouts folder for a site will affect other sites on the server. This also means that the content you modified has only one version on your system, so you 'd better back up the content. Otherwise, you must reinstall Sharepoint to re-run these files.

Create an exclusive _ layouts virtual directory

As mentioned above, changing the pages of all sites on the server can be good or bad. If all the sites use the same layout, interface, and function, you must modify them directly in the _ layouts folder (preferably after backing up the _ layouts folder ). However, if each site is different, direct modification is not feasible. At this time, you can create a site exclusive _ layouts folder and modify it in this exclusive folder. Follow these steps to create an exclusive _ layouts folder for a single site:

1. Open the C: Program filescommon filesmicrosoft sharedweb server extension12template folder.

2. Select the layouts folder and copy it.

3. Open the root directory of the SharePoint site you want to change

4. paste the layouts folder to the root directory of the SharePoint site.

5. Rename the layouts folder to _ layouts.

6. Open IIS Manager

7. Expand the corresponding SharePoint website Node

8. Right-click the _ layouts virtual directory and select Properties from the pop-up menu.

9. In the displayed Properties window, select the virtual directory tab and modify the local path so that it points to the created _ layouts folder.

10. Click OK to change the application.

Now you can modify the files in the independent _ layouts folder without affecting other sites.

Note: Some operations in the management center, such as expanding a site or changing the Authentication mode, will reset the _ layouts virtual directory of the SharePoint site to the default folder, you need to repeat the above steps.

Login. ASPX page and its template page

Open login. ASPX page, you will soon find that this is actually a content page that contains only some labels, such as table layout, user name input box, password box logon button, and a check box that remembers me. These labels are sufficient to implement the basic functions of a logon box, but far from making the page more beautiful and complex. The login. ASPX page inherits from the simple. Master template page in the _ layouts folder. Its style is determined by simple. master. The following code can be found in the header of login. aspx, which associates login. aspx with simple. master.

<% @ Page Language = "C #" inherits = "Microsoft. Sharepoint. applicationpages. loginpage" masterpagefile = "~ /_ Layouts/simple. Master "%>

When you begin to consider modifying the login form style, you must first clarify your goals. If you want to modify the style around the form, you must edit the simple. Master template page. If you want to modify a form, such as resetting controls, adding additional help statements, and images, You need to modify the login. aspx logon page.

Modify the simple. Master template page

Like most template pages, or some independent pages, simple. master controls the page style. In fact, he controls the styles of the seven pages under the _ layouts folder.

Page Description
Accessdenied. aspx When your request is rejected, a warning message is displayed on this page. This page displays the user currently logged on and the link for logging on with another user.
Confirmation. aspx Displays information about successful operations.
Error. aspx Error display page.
Login. aspx Logon page.
Reqacc. aspx When a request is rejected, a warning is displayed on this page.
Signout. aspx Click the page displayed after logout.
Webdeleted. aspx Delete the page displayed after the website is deleted.

In principle, users who access a Sharepoint site using form authentication will frequently browse the above pages. Therefore, you must make clear how much impact simple. Master will have on your SharePoint site. However, based on the above seven pages, the problem is that you can modify what is in simple. Master and what must be kept. The template page contains many contentplaceholders controls that determine which parts of a content page can be inserted into the content. The content page contains many content controls, which are associated with the contentplaceholders control on the template page. If a content page is associated with the contentplaceholders control on the template page and you delete the contentplaceholders control, an error occurs. Therefore, the key to modifying the template page is not to delete any required contentplaceholders controls.

Some contentplaceholders controls on the template page may be required by a page, but they are not required by other pages. Therefore, it is difficult to determine whether a contentplaceholders control is required. For example, simple. the master has a controller named placeholderpageimage. If you delete it, login. the ASPX page does not have errors because login. the ASPX page is not associated with this control, but accessdenied. aspx will cause an error, because this page needs to use placeholderpageimage to insert some small icons. Simple. the master page only controls the layout of the seven pages. It may not take a lot of time to test whether you have deleted a required control, however, I am not lucky with other template pages. For example, application. master controls the layout and style of over 200 pages.

One way to avoid deleting required controls is to hide them on the page. The procedure is as follows:

1. Open the template page file

2. Add a hidden panel control at the bottom of the page. The Code is as follows:

<asp:panel runat="server" visible="false">
     </asp:panel>

3. view all the labels on the Content Page. On the template page, find all the corresponding contentplaceholders controls or other server controls that play the same role.

4. Each time a contentplaceholders control (or a server control) is found, cut and paste it into the hidden panel just added.

After that, all server controls on the template page will be completely included in a hidden panel. View All associated pages. Because all controls still exist, these pages will not display any errors. However, all page elements are hidden. Now you can edit the style of the template page. For example, you can add some brand elements to your company's images. You can also go back to the template page to add some server controls you need.

If you are curious, the following lists all the contentplaceholders controls required by simple. Master:

  · PlaceHolderAdditionalPageHead
  · PlaceHolderPageTitle
  · PlaceHolderSiteName
  · PlaceHolderTopNavBar
  · PlaceHolderTitleBreadcrumb
  · PlaceHolderPageImage
  · PlaceHolderPageTitleInTitleArea
  · PlaceHolderMain
  · PlaceHolderPageDescription

You may also want to keep a scriptlink control named scriptlink1, because it contains a lot of JavaScript.

Modify logon page

Modifying a content page is not as dangerous as modifying a template, because all the error bugs only appear on the Content Page. You can back up data in advance and refresh the browser after each modification to check whether an error has occurred. Similar to the template page, you must pay attention to some classes that control the entire page in the content page. They depend on some special elements on the page. If the page elements required by these classes are lost, the page will throw an error. If you do not want something to be displayed, place it in the hidden panel rather than directly modifying the Page code.

The modification to the content page is similar, basically adding some additional content and modifying the page layout. However, it should be clear that all pages of SharePoint are based on ASP. NET technology. Similarly, these pages can be modified by modifying common ASP. NET pages. If you want them, you can make a lot of changes. For example, modify login. aspx on the logon page. We can find the following code on the logon page:

   <%@ Page Language="C#"
     Inherits="Microsoft.SharePoint.ApplicationPages.LoginPage"
     MasterPageFile="~/_layouts/simple.master" %>

Note that the logon page is associated with simple. Master as its template page. Its functions inherit from the Microsoft. Sharepoint. applicationpages. loginpage class. If you do not want to log on to the page using the template page, you can delete the masterpagefile attribute and delete all related labels in login. aspx. I don't recommend this, but you can do it. Or you do not like Microsoft. Sharepoint. applicationpages. loginpage to control the entire page. You can also delete this element to completely delete the entire page logic, or point it to another class. If you delete this inherited element, you can add some server scripts directly on login. aspx to write custom code for this page. I placed the following code on my login. ASPX page, which implements the login function normally:

  <%@ Page Language="C#" %>
  <script runat="server">
    protected override void OnLoad(EventArgs e)
    {
         Response.Write("This is from the onload event");
         base.OnLoad(e);
     }
  </script>
      <body>
       <form runat="server">
         <asp:login id="login" runat="server" />
       </form>
     </body>
  

This is definitely not a good way to process template pages and control classes for a Sharepoint page. However, this does provide a flexible way to modify the page.

Conclusion

Now you know where to find the SharePoint login page login. aspx and the template file that controls the login page style and layout. You also learned about the global impact of page modification in the _ layouts folder, and how to avoid affecting other sites on the server when you need to modify a single site. At the same time, you have obtained some good guidance for modifying the template page, and explained that we can make any modifications to the content page.

Therefore, you should try to make any changes you want on the login page or other SharePoint application pages.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.