I have come across a scenario where I was thinking on adding to the "Access Denied" sets of pages, specifically the "Request Access" page. I had abandoned the idea for the project, but I thought that I would post the "If I did it scenario" (sad O.J. Simpson book reference attempt). :) I know that you’re probably like “James, that’s great, but how the heck do I control the email generation from the page?” Well, that’s another issue, but can be fixed. At the top of the reqacc.aspx page, there is the following:
First off, if you have never seen this page in SharePoint, you will someday (below).
Anyways, I wanted to modify the page that shows up after this page if you click "Request access". The page that pulls up will have a textarea that you can fill in and then submit. This request goes to the site owner of the SharePoint site. Below, I had found the page that you can modify to change the form around to whatever you want. The only drawback here is that if you change it, it will affect all the Sharepoint sites in the server farm because they all reference this page.
Page Location: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\reqacc.aspx
I decided to add two extra form fields to it, FullName and Department.
This page also uses a resource file which is independent per web application. You can simply open up the “resx” resource file and edit the tag you want. You do not need to restart IIS after making a change to the resource file – just refresh the page.
Resource Location: C:\Inetpub\wwwroot\wss\VirtualDirectories\
File Name: wss.en-US.resx (differs by language used)
Tags to Change (if you desire):
<%@ Assembly Name="Microsoft.SharePoint.ApplicationPages, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%><%@ Page Language="C#" Inherits="Microsoft.SharePoint.ApplicationPages.RequestAccess" MasterPageFile="~/_layouts/simple.master" %><%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
So, if you want to see the default code that is used to make the “magic” happen for email generation, fire open Reflector (download Reflector) on the SharePoint server and open up the Microsoft.SharePoint.ApplicationPages.dll.
Location: C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\CONFIG\BIN\Microsoft.SharePoint.ApplicationPages.dll
Expand all the classes until you find RequestAccess. Then, Right-Click on RequestAccess and click Disassemble. Presto! There is the email generation code and how it’s getting the information to build the URL.
So, you now have access to the front end and the back end of this small part of SharePoint. You just have to create your own customized code behind (and perhaps a copy of the form for the front end so you don’t modify the OOTB page).
Enjoy!
Thursday, October 23, 2008
MOSS 2007 - Anatomy of the Request Access Page
Labels:
MOSS 2007,
SharePoint,
Tips and Tricks
(0) comments
Subscribe to:



