In this post we will discuss how to get page title and URL in SharePoint 2010 using server object model?
Also you can check out:
- How to do exception handling in client object model in SharePoint 2010
- How to create event receivers using Visual Studio 2010 in SharePoint 2010?
- Create list using SharePoint 2013 client object model in autohosted apps
To get the Page Title in SharePoint using SharePoint 2010 object model, you can follow the below approach.
User the below namespace:
using Microsoft.SharePoint;
Then write the below code to get the Title
String Title= SPContext.Current.Item["Title"].ToString();
Similarly you can get the URL in the below way
Sting URL=System.Web.HttpContext.Current.Request.Path;
Also you can check out:
- How to do exception handling in client object model in SharePoint 2010
- How to create event receivers using Visual Studio 2010 in SharePoint 2010?
- Create list using SharePoint 2013 client object model in autohosted apps
To get the Page Title in SharePoint using SharePoint 2010 object model, you can follow the below approach.
User the below namespace:
using Microsoft.SharePoint;
Then write the below code to get the Title
String Title= SPContext.Current.Item["Title"].ToString();
Similarly you can get the URL in the below way
Sting URL=System.Web.HttpContext.Current.Request.Path;