通过ASP.NET获取URL地址
如果测试的url地址是http : //www.test.com/testweb/default.aspx, 结果如下:
Request.ApplicationPath: /testweb
Request.CurrentExecutionFilePath: /testweb/default.aspx
Request.FilePath: /testweb/default.aspx
Request.Path: /testweb/default.aspx
Request.PhysicalApplicationPath: E:\WWW\testwebRequest.PhysicalPath:
Request.PhysicalPath: E:\WWW\testweb\default.aspx
Request.RawUrl: /testweb/default.aspx
Request.Url.AbsolutePath: /testweb/default.aspx
Request.Url.AbsoluteUrl: http://www.test.com/testweb/default.aspx
Request.Url.Host: www.test.com
Request.Url.LocalPath: /testweb/default.aspx
網址:http://localhost:1897/News/Press/Content.aspx/123?id=1#toc
Request.ApplicationPath
/
Request.PhysicalPath
D:\Projects\Solution\web\News\Press\Content.aspx
System.IO.Path.GetDirectoryName(Request.PhysicalPath)
D:\Projects\Solution\web\News\Press
Request.PhysicalApplicationPath
D:\Projects\Solution\web\
System.IO.Path.GetFileName(Request.PhysicalPath)
Content.aspx
Request.CurrentExecutionFilePath
/News/Press/Content.aspx
Request.FilePath
/News/Press/Content.aspx
Request.Path
/News/Press/Content.aspx/123
Request.RawUrl
/News/Press/Content.aspx/123?id=1
Request.Url.AbsolutePath
/News/Press/Content.aspx/123
Request.Url.AbsoluteUri
http://localhost:1897/News/Press/Content.aspx/123?id=1
Request.Url.Scheme
http
Request.Url.Host
localhost
Request.Url.Port
1897
Request.Url.Authority
localhost:1897
Request.Url.LocalPath
/News/Press/Content.aspx/123
Request.PathInfo
/123
Request.Url.PathAndQuery
/News/Press/Content.aspx/123?id=1
Request.Url.Query
?id=1
Request.Url.Fragment
Request.Url.Segments
/
News/
Press/
Content.aspx/
123
相关文档:
1:在.aspx页面,<% %>标签相当于在.cs页面的代码,也就是说你在.cs文件里面怎样写,就可以在.aspx文件里面的<% %>标签里面怎样写。
2:在.aspx页面,<%= %>标签可以调用你的后台的变量或者方法等,不过被调用的方法必须是public的。
如果你的Default.cs文件里面有:
public string str = "调用后台方 ......
刚学习ASP.NET AJAX开发,今天遇到一个奇怪的问题,可能是自己不熟的原因!!
在vs2005启动的时候,在asmx文件中,添加断点,启动调试能正常进入到调试页面,然后修改asmx页面以后,
重新启动调试,就不能正常进入到asmx文件中的断点,而且文件修改的地方,对于页面调用直接无效,显示效果始终是修改前的效果!!
......
1将sql中使用的一些特殊符号,如' -- /* ; %等用Replace()过滤;
2限制文本框输入字符的长度;
3检查用户输入的合法性;客户端与服务器端都要执行,可以使用正则。
4使用带参数的SQL语句形式。
ASP.NET中如何防范SQL注入式攻击
一、什么是SQL注入式攻击?
所谓SQL注入式攻击,就是攻击者把 ......
ASP.NET 4的Web Forms当中,最令人激赏的,则莫过于是URL Routing机制的全面支持。过去在ASP.NET 3.5 SP1当中,Web Forms或多或少就开始支持URL Routing机制,它让我们在网址的呈现以及使用上更加的有弹性。
过去我们在ASP.NET当中,习惯于底下这样的网址呈现方式:
http://myWebSite/EditProduct.aspx?Id=1
但最近几年R ......
1 获取错误信息并到指定页面不要使用Response.Redirect,而应该使用Server.Transfer
e.g
// in global.asax
protected void Application_Error(Object sender, EventArgs e) {
if (Server.GetLastError() is HttpUnhandledException)
Server.Transfer("MyErrorPage.aspx");
//其余的非HttpUnhandledExceptio ......