Export (0) Print
Expand All

SPWebApplication.GetMappedPage Method (SPWebApplication.SPCustomPage)

Returns the location of the customized application page.

Namespace:  Microsoft.SharePoint.Administration
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: No

public string GetMappedPage(
	SPWebApplication.SPCustomPage key
)

Parameters

key
Type: Microsoft.SharePoint.Administration.SPWebApplication.SPCustomPage
The customized application page mapping to retrieve.

Return Value

Type: System.String
The location of the customized application page. Otherwise, a null reference (Nothing in Visual Basic).

The following code example shows how to retrieve the application page mapping using an SPWebApplication.SPCustomPage enumeration object.


using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;

namespace GetCustomAppPage
{
    class Program
    {
        static void Main(string[] args)
        {
            using (SPSite site = new SPSite("http://localhost"))
            {
                //Get a reference to the web application.
                SPWebApplication webApp = site.WebApplication;

                //Output the name of the custom application page.
                Console.Out.WriteLine(webApp.GetMappedPage(SPWebApplication.SPCustomPage.AccessDenied));
                
                Console.Out.WriteLine("Press any key...");
                Console.ReadKey();
            }
        }
    }
}


Imports System
Imports Microsoft.SharePoint
Imports Microsoft.SharePoint.Administration
Module Module1

    Sub Main()

        Using site As New SPSite("http://localhost")

            'Get a reference to the web application.
            Dim webApp As SPWebApplication = site.WebApplication

            'Output the newly assigned application page.
            Console.Out.WriteLine(webApp.GetMappedPage(SPWebApplication.SPCustomPage.AccessDenied))

            Console.Out.WriteLine("Press any key...")
            Console.ReadKey()
        End Using

    End Sub

End Module

Community Additions

ADD
Show:
© 2014 Microsoft