ScrewTurn.Wiki.Tools.UrlEncode C# (CSharp) Method

UrlEncode() public static method

Executes URL-encoding, avoiding to use '+' for spaces.
public static UrlEncode ( string input ) : string
input string The input string.
return string
        public static string UrlEncode(string input)
        {
            if(HttpContext.Current != null && HttpContext.Current.Server != null) return HttpContext.Current.Server.UrlEncode(input).Replace("+", "%20");
            else {
                Log.LogEntry("HttpContext.Current or HttpContext.Current.Server were null (Tools.UrlEncode)", EntryType.Warning, Log.SystemUsername);
                return input;
            }
        }

Usage Example

示例#1
0
 /// <summary>
 /// Redirects to the login page if needed.
 /// </summary>
 public static void RedirectToLoginIfNeeded()
 {
     if (SessionFacade.LoginKey == null)
     {
         UrlTools.Redirect("Login.aspx?Redirect=" + Tools.UrlEncode(Tools.GetCurrentUrlFixed()));
     }
 }
All Usage Examples Of ScrewTurn.Wiki.Tools::UrlEncode