Creating custom URL tokens in ASP.NET (a la MOSS)

In ASP.NET, a tilde (~) is treated as a token in URLs and considers paths whose prefix matches the application root. This is a well-known functionality.

There are other tokens in MOSS, such as ~ sitecollection / mypath ... which behaves the same way, but treats the path as relative to the root of the site collection. How is this achieved? After a quick search, I could not find any information on how to add tokens like this to the .NET URL resolver.

+1
source share
3 answers

This may not be the only place, but SPUtility.GetServerRelativeUrlFromPrefixedUrl () will parse the URLs with ~ site and ~ sitecollection. MOSS also provides SPUrlExpressionBuilder for declarative use:

<link runat="server" rel="stylesheet" type="text/css"
      href="<% $SPUrl:~SiteCollection/Style Library/MyStyles/style.css %>" />
+5
source

I don’t know for sure, but I would promise that this code is similar to one of the SharePoint HTTP mods or HTTPHandlers that run for each request.

0
source

, , , - . URL- , , - , , .

0

Source: https://habr.com/ru/post/1721245/


All Articles