首页 > 编程知识 正文

域名url转发怎么设置,域名和url有什么区别

时间:2023-05-05 04:25:19 阅读:52438 作者:3661

asp.net获取当前url当前页面的完整地址是http://www.jb51.net/aaa/bbb.aspx吗? id=5name=kelli

“http://”是协议名称

' www.jb51.net '是域名

“aaa”是站点名称

' bbb.aspx '是页面名称(文件名)

' id=5name=kelli '是参数

【1】获取完整的url (协议名域名网站名文件名参数)

代码为以下:

string url=Request.Url.ToString (;

URL=http://www.jb51.net/AAA/BBB.aspx? id=5name=kelli

【2】获取网站名称页面名称参数:

代码为以下:

string url=Request.RawUrl;

(或string URL=request.URL.pathandquery; )

url=/aaa/bbb.aspx? id=5name=kelli

【3】获取网站名称页面名称:

代码为以下:

string URL=httpcontext.current.request.URL.absolute path;

(或string URL=httpcontext.current.request.path; )

url=aaa/bbb.aspx

【4】获取域名:

代码为以下:

string URL=httpcontext.current.request.URL.host;

url= www.jb51.net

【5】参数获取:

代码为以下:

string URL=httpcontext.current.request.URL.query;

url=? id=5name=kelli

代码为以下:

request.raw URL------/default2. aspx,获取客户端请求的URL信息(主机和端口除外)----/default2.aspx

Request.ApplicationPath :获取指向服务器上的ASP.NET APP应用程序的虚拟路径。 --------/

request.currentexecutionfilepath :获取当前请求的虚拟路径。 ------/Default2.aspx

Request.Path :获取当前请求的虚拟路径。 ------/Default2.aspx

request.pathinfo :具有URL扩展名的资源的其他路径信息------

Request.PhysicalPath :获取与请求的URL相对应的物理文件系统路径。 ------e :tempdefault2. aspx

request.URL.local path---/default2. aspx

request.URL.absolute uri---- http://localhost 33608080/default2. aspx

request.URL.absolute path-----------default2. aspx

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。