相关的生成权限校验的网站地址参数
2017-02-26 20:34:46 访问(1348) 赞(0) 踩(0)
/// <summary>
/// 页面加密密钥 +
/// </summary>
protected readonly static string pageSignKey
=
System.Configuration.ConfigurationManager.AppSettings
["SlowX.WebSite.BLL.WebSiteBasicBLL.pageSignKey"];
/// <summary>
/// 网站MD5加密 +
/// </summary>
/// <param name="text"></param>
/// <returns></returns>
public string WebSiteMD5(string text)
{
return GetGB2312MD5(text + pageSignKey);
}
/// <summary>
/// 网站MD5校验 +
/// </summary>
/// <param name="text"></param>
/// <returns></returns>
public bool WebSiteMD5Check(string text,string sign)
{
return GetGB2312MD5(text + pageSignKey) == sign;
}
/// <summary>
/// 构建参数 +
/// </summary>
/// <param name="curId"></param>
/// <returns></returns>
public string BuildDownLoadParams(long curId)
{
StringBuilder theResult = new StringBuilder();
string dt = DateTime.Now.ToString("yyyyMMddHHmmss");
string guid = System.Guid.NewGuid().ToString("N");
theResult.Append("?id=" + curId.ToString());
theResult.Append("&dt=" + HttpContext.Current.Server.UrlEncode(dt));
theResult.Append("&guid=" + HttpContext.Current.Server.UrlEncode(guid));
string str = curId.ToString() + dt + guid + pageSignKey;
str = GetGB2312MD5(str);
theResult.Append("&sign=" + str);
return theResult.ToString();
}
/// <summary>
/// 构建参数 +
/// </summary>
/// <param name="curId"></param>
/// <param name="dt"></param>
/// <param name="guid"></param>
/// <returns></returns>
public string BuildDownLoadParams(long curId, string dt, string guid)
{
StringBuilder theResult = new StringBuilder();
theResult.Append("?id=" + curId.ToString());
theResult.Append("&dt=" + HttpContext.Current.Server.UrlEncode(dt));
theResult.Append("&guid=" + HttpContext.Current.Server.UrlEncode(guid));
string str = curId.ToString() + dt + guid + pageSignKey;
str = GetGB2312MD5(str);
theResult.Append("&sign=" + str);
return theResult.ToString();
}
/// <summary>
/// 校验参数 +
/// </summary>
/// <returns></returns>
public bool CheckDownLoadParams()
{
string curId = HttpContext.Current.Request.QueryString["id"];
string dt = HttpContext.Current.Request.QueryString["dt"];
string guid = HttpContext.Current.Request.QueryString["guid"];
string sign = HttpContext.Current.Request.QueryString["sign"];
if (curId == null || dt == null || guid == null || sign == null)
return false;
curId = HttpContext.Current.Server.UrlDecode(curId);
dt = HttpContext.Current.Server.UrlDecode(dt);
guid = HttpContext.Current.Server.UrlDecode(guid);
sign = HttpContext.Current.Server.UrlDecode(sign);
string str = curId + dt + guid + pageSignKey;
str = GetGB2312MD5(str);
return (sign == str);
}
/// <summary>
/// 构建参数
/// </summary>
/// <param name="curId"></param>
/// <param name="isDLL"></param>
/// <returns></returns>
public string BuildSourceCodeDownLoadParams(long curId, bool isDLL)
{
StringBuilder theResult = new StringBuilder();
string strIsDLL = "0";
if(isDLL)
strIsDLL = "1";
string dt = DateTime.Now.ToString("yyyyMMddHHmmss");
string guid = System.Guid.NewGuid().ToString("N");
theResult.Append("?id=" + curId.ToString());
theResult.Append("&isdll=" + strIsDLL);
theResult.Append("&dt=" + HttpContext.Current.Server.UrlEncode(dt));
theResult.Append("&guid=" + HttpContext.Current.Server.UrlEncode(guid));
string str = curId.ToString() + strIsDLL + dt + guid + pageSignKey;
str = GetGB2312MD5(str);
theResult.Append("&sign=" + str);
return theResult.ToString();
}
/// <summary>
/// 校验参数
/// </summary>
/// <returns></returns>
public bool CheckSourceCodeDownLoadParams()
{
string curId = HttpContext.Current.Request.QueryString["id"];
string strIsDLL = HttpContext.Current.Request.QueryString["isdll"];
string dt = HttpContext.Current.Request.QueryString["dt"];
string guid = HttpContext.Current.Request.QueryString["guid"];
string sign = HttpContext.Current.Request.QueryString["sign"];
if (curId == null || strIsDLL == null || dt == null || guid == null || sign == null)
return false;
curId = HttpContext.Current.Server.UrlDecode(curId);
dt = HttpContext.Current.Server.UrlDecode(dt);
guid = HttpContext.Current.Server.UrlDecode(guid);
sign = HttpContext.Current.Server.UrlDecode(sign);
string str = curId + strIsDLL + dt + guid + pageSignKey;
str = GetGB2312MD5(str);
return (sign == str);
}
/// <summary>
/// 构建参数
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
public string BuildViewSrcParams(string fileName)
{
StringBuilder theResult = new StringBuilder();
string dt = DateTime.Now.ToString("yyyyMMddHHmmss");
string guid = System.Guid.NewGuid().ToString("N");
theResult.Append("?fileName=" + HttpContext.Current.Server.UrlEncode(fileName));
theResult.Append("&dt=" + HttpContext.Current.Server.UrlEncode(dt));
theResult.Append("&guid=" + HttpContext.Current.Server.UrlEncode(guid));
string str = fileName + dt + guid + pageSignKey;
str = GetGB2312MD5(str);
theResult.Append("&sign=" + str);
return theResult.ToString();
}
/// <summary>
/// 构建参数
/// </summary>
/// <param name="fileName"></param>
/// <param name="dt"></param>
/// <param name="guid"></param>
/// <returns></returns>
public string BuildViewSrcParams(string fileName, string dt, string guid)
{
StringBuilder theResult = new StringBuilder();
theResult.Append("?fileName=" + HttpContext.Current.Server.UrlEncode(fileName));
theResult.Append("&dt=" + HttpContext.Current.Server.UrlEncode(dt));
theResult.Append("&guid=" + HttpContext.Current.Server.UrlEncode(guid));
string str = fileName + dt + guid + pageSignKey;
str = GetGB2312MD5(str);
theResult.Append("&sign=" + str);
return theResult.ToString();
}
/// <summary>
/// 校验参数
/// </summary>
/// <returns></returns>
public bool CheckViewSrcParams()
{
string fileName = HttpContext.Current.Request.QueryString["fileName"];
string dt = HttpContext.Current.Request.QueryString["dt"];
string guid = HttpContext.Current.Request.QueryString["guid"];
string sign = HttpContext.Current.Request.QueryString["sign"];
if (fileName == null || dt == null || guid == null || sign == null)
return false;
fileName = HttpContext.Current.Server.UrlDecode(fileName);
dt = HttpContext.Current.Server.UrlDecode(dt);
guid = HttpContext.Current.Server.UrlDecode(guid);
sign = HttpContext.Current.Server.UrlDecode(sign);
string str = fileName + dt + guid + pageSignKey;
str = GetGB2312MD5(str);
return (sign == str);
}
/// <summary>
/// 构建参数
/// </summary>
/// <param name="preName"></param>
/// <returns></returns>
public string BuildSelectAspxParams(string preName)
{
StringBuilder theResult = new StringBuilder();
string dt = DateTime.Now.ToString("yyyyMMddHHmmss");
string guid = System.Guid.NewGuid().ToString("N");
if (preName == null || preName.Length == 0)
{
preName = "";
theResult.Append("?dt=" + HttpContext.Current.Server.UrlEncode(dt));
}
else
{
theResult.Append("?prename=" + HttpContext.Current.Server.UrlEncode(preName));
theResult.Append("&dt=" + HttpContext.Current.Server.UrlEncode(dt));
}
theResult.Append("&guid=" + HttpContext.Current.Server.UrlEncode(guid));
string str = preName + dt + guid + pageSignKey;
str = GetGB2312MD5(str);
theResult.Append("&sign=" + str);
return theResult.ToString();
}
/// <summary>
/// 构建参数
/// </summary>
/// <param name="preName"></param>
/// <param name="dt"></param>
/// <param name="guid"></param>
/// <returns></returns>
public string BuildSelectAspxParams(string preName, string dt, string guid)
{
StringBuilder theResult = new StringBuilder();
if (preName == null || preName.Length == 0)
{
preName = "";
theResult.Append("?dt=" + HttpContext.Current.Server.UrlEncode(dt));
}
else
{
theResult.Append("?prename=" + HttpContext.Current.Server.UrlEncode(preName));
theResult.Append("&dt=" + HttpContext.Current.Server.UrlEncode(dt));
}
theResult.Append("&guid=" + HttpContext.Current.Server.UrlEncode(guid));
string str = preName + dt + guid + pageSignKey;
str = GetGB2312MD5(str);
theResult.Append("&sign=" + str);
return theResult.ToString();
}
/// <summary>
/// 校验参数
/// </summary>
/// <returns></returns>
public bool CheckSelectAspxParams()
{
string preName = HttpContext.Current.Request.QueryString["prename"];
string dt = HttpContext.Current.Request.QueryString["dt"];
string guid = HttpContext.Current.Request.QueryString["guid"];
string sign = HttpContext.Current.Request.QueryString["sign"];
if ( dt == null || guid == null || sign == null)
return false;
if (preName == null)
preName = "";
else
preName = HttpContext.Current.Server.UrlDecode(preName);
dt = HttpContext.Current.Server.UrlDecode(dt);
guid = HttpContext.Current.Server.UrlDecode(guid);
sign = HttpContext.Current.Server.UrlDecode(sign);
string str = preName + dt + guid + pageSignKey;
str = GetGB2312MD5(str);
return (sign == str);
}
/// <summary>
/// 构建参数
/// </summary>
/// <param name="rootDir"></param>
/// <param name="allowPubDir"></param>
/// <param name="allowAllDir"></param>
/// <returns></returns>
public string BuildFileUploadParams
(
string rootDir,
bool allowPubDir,
bool allowAllDir
)
{
StringBuilder theResult = new StringBuilder();
string dt = DateTime.Now.ToString("yyyyMMddHHmmss");
string guid = System.Guid.NewGuid().ToString("N");
theResult.Append("?allowPubDir=" + BooleanSlowXFunctions.GetStrByBoolean(allowPubDir));
theResult.Append("&allowAllDir=" + BooleanSlowXFunctions.GetStrByBoolean(allowAllDir));
if (rootDir == null || rootDir.Length == 0)
{
rootDir = "";
}
else
{
theResult.Append("&rootDir=" + HttpContext.Current.Server.UrlEncode(rootDir));
}
theResult.Append("&dt=" + HttpContext.Current.Server.UrlEncode(dt));
theResult.Append("&guid=" + HttpContext.Current.Server.UrlEncode(guid));
string str = rootDir + BooleanSlowXFunctions.GetStrByBoolean(allowPubDir) + BooleanSlowXFunctions.GetStrByBoolean(allowAllDir) + dt + guid + pageSignKey;
str = GetGB2312MD5(str);
theResult.Append("&sign=" + str);
return theResult.ToString();
}
/// <summary>
/// 构建参数
/// </summary>
/// <param name="rootDir"></param>
/// <param name="allowPubDir"></param>
/// <param name="allowAllDir"></param>
/// <param name="dt"></param>
/// <param name="guid"></param>
/// <returns></returns>
public string BuildFileUploadParams
(
string rootDir,
bool allowPubDir,
bool allowAllDir,
string dt,
string guid
)
{
StringBuilder theResult = new StringBuilder();
theResult.Append("?allowPubDir=" + BooleanSlowXFunctions.GetStrByBoolean(allowPubDir));
theResult.Append("&allowAllDir=" + BooleanSlowXFunctions.GetStrByBoolean(allowAllDir));
if (rootDir == null || rootDir.Length == 0)
{
rootDir = "";
}
else
{
theResult.Append("&rootDir=" + HttpContext.Current.Server.UrlEncode(rootDir));
}
theResult.Append("&dt=" + HttpContext.Current.Server.UrlEncode(dt));
theResult.Append("&guid=" + HttpContext.Current.Server.UrlEncode(guid));
string str = rootDir + BooleanSlowXFunctions.GetStrByBoolean(allowPubDir) + BooleanSlowXFunctions.GetStrByBoolean(allowAllDir) + dt + guid + pageSignKey;
str = GetGB2312MD5(str);
theResult.Append("&sign=" + str);
return theResult.ToString();
}
/// <summary>
/// 校验参数
/// </summary>
/// <returns></returns>
public bool CheckFileUploadParams()
{
string rootDir = HttpContext.Current.Request.QueryString["rootDir"];
bool allowPubDir = HttpContextSlowXFunctions.GetBooleanParameter("allowPubDir");
bool allowAllDir = HttpContextSlowXFunctions.GetBooleanParameter("allowAllDir");
string dt = HttpContext.Current.Request.QueryString["dt"];
string guid = HttpContext.Current.Request.QueryString["guid"];
string sign = HttpContext.Current.Request.QueryString["sign"];
if (dt == null || guid == null || sign == null)
return false;
if (rootDir == null)
rootDir = "";
else
rootDir = HttpContext.Current.Server.UrlDecode(rootDir);
dt = HttpContext.Current.Server.UrlDecode(dt);
guid = HttpContext.Current.Server.UrlDecode(guid);
sign = HttpContext.Current.Server.UrlDecode(sign);
string str =
rootDir
+ BooleanSlowXFunctions.GetStrByBoolean(allowPubDir)
+ BooleanSlowXFunctions.GetStrByBoolean(allowAllDir)
+ dt + guid + pageSignKey;
str = GetGB2312MD5(str);
return (sign == str);
}
/// <summary>
/// 构建参数
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
public string BuildDeleteFileParams(string fileName)
{
if (fileName == null || fileName.Length == 0)
return "";
StringBuilder theResult = new StringBuilder();
string dt = DateTime.Now.ToString("yyyyMMddHHmmss");
string guid = System.Guid.NewGuid().ToString("N");
theResult.Append("?filename=" + HttpContext.Current.Server.UrlEncode(fileName));
theResult.Append("&dt=" + HttpContext.Current.Server.UrlEncode(dt));
theResult.Append("&guid=" + HttpContext.Current.Server.UrlEncode(guid));
string str =
fileName
+ dt + guid + pageSignKey;
str = GetGB2312MD5(str);
theResult.Append("&sign=" + str);
return theResult.ToString();
}
/// <summary>
/// 校验参数
/// </summary>
/// <returns></returns>
public bool CheckDeleteFileParams()
{
string filename = HttpContext.Current.Request.QueryString["filename"];
string dt = HttpContext.Current.Request.QueryString["dt"];
string guid = HttpContext.Current.Request.QueryString["guid"];
string sign = HttpContext.Current.Request.QueryString["sign"];
if (dt == null || guid == null || sign == null || filename==null)
return false;
if (filename.Length == 0)
return false;
filename = HttpContext.Current.Server.UrlDecode(filename);
dt = HttpContext.Current.Server.UrlDecode(dt);
guid = HttpContext.Current.Server.UrlDecode(guid);
sign = HttpContext.Current.Server.UrlDecode(sign);
string str =
filename
+ dt + guid + pageSignKey;
str = GetGB2312MD5(str);
return (sign == str);
}
标签:
相关的生成权限校验的网站地址参数 


上一条:
下一条:
相关评论
发表评论