Thursday, November 22, 2012

How to deploy a page in SharePoint File system and then set it acess url through module in SharePoint 2010.

Here I am going to add a page to a  and then configure it to access through SharePoint Site collection URL. This is the best way to add an application page with code behind. So here are the steps :

1.) Open Visual Studio 2010. Add a new project. Expand SharePoint button. Select 2010 and then choose  Module template in all provided templates. We need to deploy it as farm Solution because we need to write code behind that would be deployed in GAC and moreover we are adding a page into file system. I have given this project SharePointModulePOC. It will look like this now :

2.) Here we can see a feature is added to the solution we can expand feature node and select Feature1 and it would like this containing your module. In the very same way it contains any other element.

3.) Now we will add a aspx page to the module by right clicking on it select add a New Item and POCApplicationPage.aspx page with its default content. Now it will look like this :

4.) Now deploy this solution and you can access this page by adding this URL" /Module1/POCApplicationPage.aspx" to site URL. Suppose site URL is "http://servername:portnumber/sites/sitecollection" and then page URL will be "http://servername:portnumber/sites/sitecollection/Module1/POCApplicationPage.aspx".

5.) Suppose now you want to change access URL to without this module reference then you can click on this  "POCApplicationPage.aspx" page and press F4 and then select Deployment Location. and delete this module path. Now it will look like this :

Which was like this earlier :

Now you can access this page through this URL "http://minf-0091:33333/sites/TestPages/POCApplicationPage.aspx".

No comments:

Post a Comment