Mega Code Archive

 
Categories / C# / File Stream
 

Gets the path of the current request relative to the application base path

using System; using System.Collections.Generic; using System.Text; using System.IO; using System.Reflection; using System.Xml; using System.Web; /// <summary> /// Common utility functions. /// </summary> public static class Util {     /// <summary>     /// Gets the path of the current request relative to the application base path.     /// </summary>     public static string RelativePath(HttpContext context)     {         if (context.Request.ApplicationPath == "/")         {             return context.Request.Path;         }         else         {             return context.Request.Path.Substring(context.Request.ApplicationPath.Length);         }     } }