cs代码:

public partial class TelerikWebMethod : BasePage//System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
TelerikWebMethod.username = this.UserInfo.UserName;
TelerikWebMethod.domainname = this.UserInfo.DomainName;
}

      /// <summary>
      /// 加密跳转页面链接
      /// </summary>
      private static readonly byte[] key = System.Text.Encoding.Default.GetBytes("abcd12");

        [WebMethod]
public static string ReturnEncryptionPageUrl(string UserName, string DomainName)
{
string Email = string.Empty;
//string Url = "http://10.76.1.25//login.do";
string Url = "http://ia.cnpc/login.do";
string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); if (DomainName.ToUpper().Contains("PTR"))
{
Email = UserName + "@petrochina.com.cn";
}
else if (DomainName.ToUpper().Contains("CNPC"))
{
Email = UserName + "@cnpc.com.cn";
}
AESDecrypt ad = new AESDecrypt();
string user = ad.Encrypt(Email + "," + time, key);
user = HttpUtility.UrlEncode(user, Encoding.UTF8);
//user = user.Replace("+", "%20");
user = user.Replace("+", "%2B");
user = user.Replace("/", "%2F");
return Url;
}
}

  前端页面:

$.            ajax(
{
async: false,
type: "POST",
contentType: "application/json",
url: "TelerikWebMethod.aspx/ReturnEncryptionPageUrl",
data: "{'UserName':'" + UserName + "','DomainName':'" + DomainName + "'}",
dataType: "json",
success: function (msg) {
//window.open(msg.d, "newwindow", "height=100, width=400, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no") window.open(msg.d, "newwindow");
},
error: function (err) {
alert(err.responseText);
}
});

  

05-11 17:52