You're here: Snippet Directory » Microsoft .NET » ASP.NET (68)
Language:

HandleTilde()

Language: Deutsch
Programming Language: C#
Published by: Thomas
Last Update: 5/4/2006
Views: 734

Description

Wandelt einen relativ zur Applikation startenden Pfad in den vollständigen absoluten Pfad um. Benötigt wird natürlich der Name der Applikation.

Code

1 string applicationPath = ""; 2 3 private string HandleTilde(string url) 4 { 5 if ((url == null) || (url.Length < 1)) 6 return url; 7 8 if (url.StartsWith("^~/")) 9 return "^" + _applicationPath + url.Substring("^~/".Length - 1); 10 else if (url.StartsWith("~/")) 11 return _applicationPath + url.Substring("~/".Length - 1); 12 return url; 13 }

No comments avaiable

Add a comment

Name *  

Email (won't be displayed) *    

Website  

Comment *  

Sicherheitscode Security Code *    

RSS