Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to get GUID of current page?

Posted on 2012-03-21
2
Medium Priority
?
561 Views
Last Modified: 2012-03-21
Hello. Is it possible to get GUID of current page? I would like to store it to list to identify data. Something like SPContext.Current.ItemId.
0
Comment
Question by:tolppa
2 Comments
 
LVL 18

Accepted Solution

by:
ivan_vagunin earned 2000 total points
ID: 37748406
Hi!
Try:
SPFile file = SPContext.Current.Web.GetFile(HttpContext.Current.Request.Url.AbsoluteUri);
Guid pageId = file.UniqueId;

Note, that this will not work for application pages (inside /_layouts/). Consider using page url instead of guid, because page url is unique and can be used for pages of all types.
0
 
LVL 1

Author Closing Comment

by:tolppa
ID: 37749232
Thanks.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question