Create a custom SharePoint application page (Creating an application page in Windows SharePoint Services 3.0)

Source: Internet
Author: User

The application page (also known as the _ layouts page) is stored in the C:/program files/common files/Microsoft shared/Web Server Extensions/12/template/layouts directory. The corresponding virtual directory in IIS is: _ layouts.

 

The application page uses the application. master page and inherits from Microsoft. Sharepoint. webcontrols. layoutspagebase. Only authorized users can access this page.

A simple application page is shown below:

  1. <% @ Assembly name = "Microsoft. Sharepoint, version = 12.0.0.0, culture = neutral, publickeytoken = 71e9bce111e9429c" %>
  2. <% @ Page Language = "C #" masterpagefile = "~ /_ Layouts/application. Master"
  3. Inherits = "Microsoft. Sharepoint. webcontrols. layoutspagebase" %>
  4. <% @ Import namespace = "Microsoft. SharePoint" %>
  5. <SCRIPT runat = "server">
  6. Protected override void onload (eventargs E)
  7. {
  8. Spweb web = spcontext. Current. Web;
  9. Spuser currentuser = web. currentuser;
  10. Lblusername. Text = currentuser. Name;
  11. Lbluserlogin. Text = currentuser. loginname;
  12. Lbluseremail. Text = currentuser. Email;
  13. }
  14. </SCRIPT>
  15. <Asp: Content ID = "Main" contentplaceholderid = "placeholdermain" runat = "server">
  16. <Table border = "1" cellpadding = "4" cellspacing = "0" style = "font-size: 12">
  17. <Tr>
  18. <TD> currentusername: </TD>
  19. <TD> <asp: Label id = "lblusername" runat = "server"/> </TD>
  20. </Tr>
  21. <Tr>
  22. <TD> currentuserlogin: </TD>
  23. <TD> <asp: Label id = "lbluserlogin" runat = "server"/> </TD>
  24. </Tr>
  25. <Tr>
  26. <TD> currentuseremail: </TD>
  27. <TD> <asp: Label id = "lbluseremail" runat = "server"/> </TD>
  28. </Tr>
  29. </Table>
  30. </ASP: content>
  31. <Asp: Content ID = "pagetitle" runat = "server"
  32. Contentplaceholderid = "placeholderpagetitle">
  33. Hello World
  34. </ASP: content>
  35. <Asp: Content ID = "pagetitleintitlearea" runat = "server"
  36. Contentplaceholderid = "placeholderpagetitleintitlearea">
  37. The quintessential 'Hello world' application page
  38. </ASP: content>

In addition, the page under _ layout does not inherit the SharePoint class,

For example:

 

  1. <% @ Page Language = "C #" %>
  2. <% @ Assembly name = "Microsoft. Sharepoint, version = 12.0.0.0, culture = neutral, publickeytoken = 71e9bce111e9429c" %>
  3. <% @ Import namespace = "Microsoft. SharePoint" %>
  4. <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  5. <SCRIPT runat = "server">
  6. Protected override void onload (eventargs E)
  7. {
  8. Spweb web = spcontext. Current. Web;
  9. Spuser currentuser = web. currentuser;
  10. Lblusername. Text = currentuser. Name;
  11. Lbluserlogin. Text = currentuser. loginname;
  12. Lbluseremail. Text = currentuser. Email;
  13. }
  14. </SCRIPT>
  15. <HTML xmlns = "http://www.w3.org/1999/xhtml">
  16. <Head runat = "server">
  17. <Title> No title page </title>
  18. </Head>
  19. <Body>
  20. <Form ID = "form1" runat = "server">
  21. <Div>
  22. <Table border = "1" cellpadding = "4" cellspacing = "0" style = "font-size: 12">
  23. <Tr>
  24. <TD> currentusername: </TD>
  25. <TD> <asp: Label id = "lblusername" runat = "server"/> </TD>
  26. </Tr>
  27. <Tr>
  28. <TD> currentuserlogin: </TD>
  29. <TD> <asp: Label id = "lbluserlogin" runat = "server"/> </TD>
  30. </Tr>
  31. <Tr>
  32. <TD> currentuseremail: </TD>
  33. <TD> <asp: Label id = "lbluseremail" runat = "server"/> </TD>
  34. </Tr>
  35. </Table>
  36. </Div>
  37. </Form>
  38. </Body>
  39. </Html>

 

 

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.