API Questions on Kentico API.
Version 5.x > API > Detecting original alias View modes: 
User avatar
Member
Member
kelly-lion - 2/23/2012 8:18:59 AM
   
Detecting original alias
OK, this is probably obvious, but I'm not finding it. Fairly new to Kentico. I'm trying to detect the alias path of a document and set a cookie based on what the alias was.

Am I just missing the correct call?

For example:

http://www.sitename.com/Alias10 redirectes to http://www.sitename.com/File/AboutUs

I want to know Alias10

How do I get this (using 5.5R2)
Thanks,
Kelly

User avatar
Member
Member
kelly-lion - 2/23/2012 10:59:33 AM
   
RE:Detecting original alias
Can a moderator move this to the 5.x board please.

User avatar
Member
Member
kelly-lion - 2/29/2012 1:16:47 PM
   
RE:Detecting original alias
Anyone have anything? All I need to do is track what aliase the customer used to access the site, and we want the single url for the page.

I thought this would be easy, but I've asked several Kentico developers and no one has come up with anything yet.

Thanks

User avatar
Kentico Support
Kentico Support
kentico_jurajo - 3/5/2012 3:10:52 AM
   
RE:Detecting original alias
Hi,

In the HTTP response there is the URLReferrer available which you can use to detect the previous URL. Then, you can use this method from Kentico's API:

CMS.PortalEngine.PageInfoProvider.GetPageInfoForUrl(string, string, string, bool, bool, out CMS.PortalEngine.PageInfoSource, out string)

However, you need to place it into try-catch otherwise, if the URL is missing, it will throw an error.

Best regards,
Juraj Ondrus

User avatar
Guest
kenhu - 7/19/2012 3:53:14 PM
   
RE:Detecting original alias
I have found it hard to find references on what to pass into the method call. Could you point us to some examples?

kentico_jurajo wrote: Hi,

In the HTTP response there is the URLReferrer available which you can use to detect the previous URL. Then, you can use this method from Kentico's API:

CMS.PortalEngine.PageInfoProvider.GetPageInfoForUrl(string, string, string, bool, bool, out CMS.PortalEngine.PageInfoSource, out string)

However, you need to place it into try-catch otherwise, if the URL is missing, it will throw an error.

Best regards,
Juraj Ondrus


User avatar
Kentico Developer
Kentico Developer
kentico_ivanat - 7/22/2012 3:51:01 PM
   
RE:Detecting original alias
Hi,

you can try to use code:

HttpContext.Current.Request.UrlReferrer

or:

GeneralConnection conn = ConnectionHelper.GetConnection();
PageInfoSource pageInfoSource = PageInfoSource.Unknown;
string wildcardQueryString = null;
PageInfo pageInfo = null;
string url=”http://localhost/test.aspx”;
pageInfo = CMS.PortalEngine.PageInfoProvider.GetPageInfoForUrl(url, "en-US", null, true, true, conn, out pageInfoSource, out wildcardQueryString);


You should also add validation to above code, because it works only in case URL exists.

Best regards,
Ivana Tomanickova