using System;
using System.Collections.Generic;
using System.Web;
using System.Security.Cryptography;

/// <summary>
///PubliclClass 的摘要说明
/// </summary>
public class PubliclClass
{
	public PubliclClass()
	{
		//
		//TODO: 在此处添加构造函数逻辑
		//
	}

    /// <summary>
    /// 获取客户端IP
    /// </summary>
    /// <returns></returns>
    public static string getIp()
    {
        if (System.Web.HttpContext.Current.Request.ServerVariables["HTTP_VIA"] != null)
            return System.Web.HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"].Split(new char[] { ',' })[0];
        else
            return System.Web.HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
    }

    /// <summary>
    /// 转换Md5
    /// </summary>
    /// <param name="str"></param>
    /// <returns></returns>
    public static string MD5(string str)
    {
        return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5");
    }



}