Hi
I need to get the pageid from a URL using the API. How can I do that?
Hi
I need to get the pageid from a URL using the API. How can I do that?
Hi Lars,
I'm not sure that you can. Why do you need this? Can you provide some more details / code?
/Morten
Hi Lars,
Are you in the context of a page load or do you have a url string, e.g. saved in a log file or database, that you need to reverse lookup?
- Jeppe
Hi Lars
There is no simple way to do that. But you can do something like this:
Dim curArea As Area = PageView.GetAreaByDomain() Dim index As UrlIndex = UrlIndex.GetIndex(UrlPageTreeHelper.Instance.GetAreaUrlIndexName(curArea)) Dim queryString = index.PathIndex.Item(requestPath).GetQueryString()
The result will be an entire querystring - could be "ID=1" or it could be "ID=1&groupid=group4" etc.
But why/where do you need it? I am pretty sure you can get access to the pageid in a better way.
BR Nicolai
Hi Jeppe
It's exactly that. I have an IIS redirect file that I want to convert to Redirects in Dynamicweb. My source file contains url's but to create the redirects in the table UrlPath I need the pageid for the url's.
You can try with the code I provided.
But there are domain rules, language rules etc. that could give you wrong or missing results.
Hi Nicolai
Yes, I will try your code and be aware of domain rules, languge rules etc. as you write. Thanks.
You must be logged in to post in the forum