且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

整个URL必须在地址栏中加密

更新时间:2023-11-26 19:26:22

不知道为什么要这么做吗?通常,URL应该足够可读.
Not sure why do you want to do that? Usually, urls should be readable enough.


从这里开始-在asp.net中重写网址 [
[4:09:51 PM] GK:无效Application_BeginRequest(对象发送者,EventArgs e)
{
/*(字符串curruntpath = Request.Path.ToLower();

curruntpath = curruntpath.Trim();
bool被重定向= curruntpath.EndsWith(.aspx");
bool isredirected2 = curruntpath.EndsWith(.html");
bool isredirected3 = curruntpath.EndsWith(.jpg");
bool isredirected4 = curruntpath.EndsWith(.jpeg");
bool isredirected5 = curruntpath.EndsWith(.gif");
bool isredirected6 = curruntpath.EndsWith(.png");
//字符串atr = curruntpath.Substring(curruntpath.IndexOf("/"));
if(!redirected&&!isredirected2&&!isredirected3& amp;!isredirected4& amp; amp;!isredirected5& amp; amp; !! isredirected6)
{

HttpContext obj = HttpContext.Current;
字符串finalurl = curruntpath +".aspx";

如果(System.IO.File.Exists(Server.MapPath(finalurl)))
{
obj.RewritePath(finalurl);
}
其他
{
obj.RewritePath("Error.aspx");
}
}
如果(curruntpath.EndsWith(.aspx"))
{
HttpContext obj = HttpContext.Current;
//obj.RewritePath("Tohideextentions.aspx);
} */
}


任何人都可以帮助我解决上面提到的代码是否正确,以便对地址栏中的整个URL进行编码/加密.
[4:09:51 PM] GK: void Application_BeginRequest(object sender, EventArgs e)
{
/*( string curruntpath = Request.Path.ToLower();

curruntpath = curruntpath.Trim();
bool isredirected = curruntpath.EndsWith(".aspx");
bool isredirected2 = curruntpath.EndsWith(".html");
bool isredirected3 = curruntpath.EndsWith(".jpg");
bool isredirected4 = curruntpath.EndsWith(".jpeg");
bool isredirected5 = curruntpath.EndsWith(".gif");
bool isredirected6 = curruntpath.EndsWith(".png");
// string atr = curruntpath.Substring(curruntpath.IndexOf("/"));
if (!isredirected && !isredirected2 && !isredirected3 && !isredirected4 && !isredirected5 && !isredirected6)
{

HttpContext obj = HttpContext.Current;
string finalurl = curruntpath + ".aspx";

if (System.IO.File.Exists(Server.MapPath(finalurl)))
{
obj.RewritePath(finalurl);
}
else
{
obj.RewritePath("Error.aspx");
}
}
if (curruntpath.EndsWith(".aspx"))
{
HttpContext obj = HttpContext.Current;
//obj.RewritePath("Tohideextentions.aspx");
}*/
}


Can Any One Help Me Weather The Above Mentioned Code Is Right For The Entire URL In The Address Bar To Be Encoded/Encrypted.