Reputation: 5670
I had some role based protected pages in my umbraco .This is the smaple URL for the one of the pages
http://aksphases:201/xmas-shop/phases-shop.aspx
When some one enter this in browser this will go to log in page with out changing the URL and when he enters correct log in credential he will see the correct page contents with out any change in URL(yes that is the way umbraco working). Now what I need is When he is at the log in page I want to get the Node-ID of the protected page . when I tried
@CurrentModel.Id
Its displaying log in page's Node-ID. as the URL is of the protected page I am sure I can get the Protected page's ID from here itself.Can any one give me any clue?
Upvotes: 0
Views: 170
Reputation: 10942
uQuery has a GetNodeByUrl
method that may help you out here. As of Umbraco v4.8, uQuery is built in to Umbraco.
Using razor, you should be able to do something like this:
@{
string url = HttpContext.Current.Request.Url.AbsolutePath;
var node = Library.NodeById(umbraco.uQuery.GetNodeByUrl(url).Id);
@node.Name
}
Upvotes: 1