如何抓住从URL的.aspx页面名称? [英] How to grab .aspx Page Name from the URL?

查看:171
本文介绍了如何抓住从URL的.aspx页面名称?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用哪些对象来从URL当前PageName.aspx(包括扩展名的.aspx)?我找不到让我抓住这个当我在页面上的对象和方法。

What object can I use to get the current PageName.aspx (including the extension .aspx) from the URL? I can't find what object and method to allow me to grab this when I'm on a page.

推荐答案

皮诺这里的源律人:的http:// www.devx.com/tips/Tip/42433

  string sPagePath = System.Web.HttpContext.Current.Request.Url.AbsolutePath;
    System.IO.FileInfo oFileInfo = new System.IO.FileInfo(sPagePath);
    string sPageName = oFileInfo.Name;

这篇关于如何抓住从URL的.aspx页面名称?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆