62,025
社区成员
发帖
与我相关
我的任务
分享
void Application_BeginRequest(object sender, EventArgs e)
{
//throw new Exception("The method or operation is not implemented.");
string strurlData = HttpContext.Current.Request.RawUrl;
if (strurlData != null && strurlData != "")
{
string[] strs = strurlData.Split('/');
bool flag = false;
for (int i=0;i<strs.Length ;i++ )
{
if (strs[i].ToUpper() == "baidu")
{
flag = true;
break;
}
}
if(flag)
HttpContext.Current.Response.Redirect("http://www.baidu.com");
void Application_BeginRequest(object sender, EventArgs e)
{
//throw new Exception("The method or operation is not implemented.");
string strurlData = HttpContext.Current.Request.RawUrl;
if (strurlData != null && strurlData != "")
{
string[] strs = strurlData.Split('/');
bool flag = false;
for (int i=0;i<strs.Length ;i++ )
{
if (strs[i].ToUpper() == "BAIDU")
{
flag = true;
break;
}
}
if(flag)
HttpContext.Current.Response.Redirect("http://www.baidu.com");
protected void Application_BeginRequest(object sender, EventArgs e)
{
//原来的url
string url = HttpContext.Current.Request.RawUrl;
//经过处理的新的url
string newUrl = ""
HttpContext.Current.RewritePath(newUrl);
}
//DEMO
string url = HttpContext.Current.Request.RawUrl;
string pattern = @"(\S+)(article/)+(\S+)(/read.aspx)(\S*)";
string newUrl = "";
if (System.Text.RegularExpressions.Regex.IsMatch(url, pattern, System.Text.RegularExpressions.RegexOptions.Compiled | System.Text.RegularExpressions.RegexOptions.IgnoreCase))
{
newUrl = System.Text.RegularExpressions.Regex.Replace(url, pattern, "$1Article.aspx?articleId=$3");
HttpContext.Current.RewritePath(newUrl);
}
<script type="text/javascript">
Jump();
function Jump()
{
var url=document.URL.toLowerCase();
if(url.indexOf("a1.iwom-trends.com")>=0 || url.indexOf("a2.iwom-trends.com")>=0 )
location.href="Login.aspx?loginout=t&adminlogin=t";
else if(url.indexOf("b1.iwom-trends.com")>=0 || url.indexOf("b2.iwom-trends.com")>=0)
location.href="Login.aspx?loginout=t&trackeradminlogin=t";
else if(url.indexOf("c1.iwom-trends.com")>=0 || url.indexOf("c2.iwom-trends.com")>=0)
location.href="Login.aspx?loginout=t";
}
</script>
直接页面加载调用js就可以。