Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 30th, 2012  |  syntax: None  |  size: 0.67 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Find the URL of an application
  2. Request.Url.AbsoluteUri.Replace(Request.Url.LocalPath, "")
  3.        
  4. string _ApplicationPath = GetCurrentPageName();
  5.         string _URL = Request.Url.ToString();
  6.         string _ReturnString;
  7.         Int32 _Position = _URL.IndexOf(_ApplicationPath);
  8.  
  9.         _ReturnString = _URL.Replace(_ApplicationPath, "");
  10.  
  11.         return _ReturnString;
  12.  
  13.     }
  14.                  public static string GetCurrentPageName()
  15.         {
  16.             string sPath = System.Web.HttpContext.Current.Request.Url.AbsolutePath;
  17.             System.IO.FileInfo oInfo = new System.IO.FileInfo(sPath);
  18.             string sRet = oInfo.Name;
  19.             return sRet.ToLower();
  20.         }