33 lines
1.0 KiB
C#
33 lines
1.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Web;
|
|
|
|
/// <summary>
|
|
/// Summary description for Utils
|
|
/// </summary>
|
|
public class Utils
|
|
{
|
|
public static string toBase64(string val)
|
|
{
|
|
var bytes = Encoding.ASCII.GetBytes(val);
|
|
return Convert.ToBase64String(bytes);
|
|
}
|
|
public static string fromBase64(string val)
|
|
{
|
|
var bytes= Convert.FromBase64String(val);
|
|
return Encoding.ASCII.GetString(bytes);
|
|
}
|
|
public static string GetCleanUrl()
|
|
{
|
|
string ActivationUrl;
|
|
if (HttpContext.Current.Request.Url.Port == 80 || HttpContext.Current.Request.Url.Port == 443)
|
|
ActivationUrl = string.Format("{1}://{0}", HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Scheme);
|
|
else
|
|
ActivationUrl = string.Format("{2}://{0}:{1}", HttpContext.Current.Request.Url.Host,
|
|
HttpContext.Current.Request.Url.Port, HttpContext.Current.Request.Url.Scheme);
|
|
|
|
return ActivationUrl;
|
|
}
|
|
} |