dg word = new dg();//dg是一个类DgName.DataSource = word.dgfunction(Convert.ToInt32(Request["ID"].ToString()));
//dgfunction是类dg中的一个函数,是获取网址中的ID的。DgName.DataBind();//数据的绑定比如:http://community.csdn.net/PostNew.asp?ID=5201。中dgfunction是获取ID5201的。请问:
现在我想获取网址中的文件PostNew.asp的名字PostNew,
该如何获取,该如何写这个获取名字的语句的代码?谢谢
//dgfunction是类dg中的一个函数,是获取网址中的ID的。DgName.DataBind();//数据的绑定比如:http://community.csdn.net/PostNew.asp?ID=5201。中dgfunction是获取ID5201的。请问:
现在我想获取网址中的文件PostNew.asp的名字PostNew,
该如何获取,该如何写这个获取名字的语句的代码?谢谢
解决方案 »
- httpResponse.ResponseUri获取值中存在中文 获取后显示乱码 求指点 在线等!!!
- Delphi中Integer在C#中对应什么类型
- StatusStrip的bug
- 回溯算法的非递归实现的问题 放100分。!!!
- 新手求教 C#windows编程
- winform中,如何将form嵌入到panel组件中,就好象网页里面的frame
- DataGridView使用ComboBox如何允许输入?
- 怎样限制文本框内,只能输入数字,字母。
- 有谁知道如何用C#给上传的图片加上水印文字?我知道怎么生成缩略图
- 有字符函数能实现这样的功能吗?11.125,我想得到它的第一位数字1和后位1.125.
- XtraGrid控件问题 我建了两个企业表(上属企业\下属企业)用XtraGrid建成上下关系表
- 刚实习,公司里面的代码看不懂~~~
string str;
str = "http://community.csdn.net/PostNew.asp?ID=5201";
int intStart, intEnd;
intStart = str.LastIndexOf("/");
intEnd = str.LastIndexOf(".");
if (intStart == -1 || intEnd == -1)
{
Console.Write("Error");
return;
}
str = str.Substring(intStart + 1, intEnd - intStart);
Console.Write(str);
int istartIndex=sUrl.LastIndexOf("/");
int iendIndex=sUrl.LastIndexOf(".");
Response.Write(sUrl.Substring(istartIndex+1,iendIndex-(istartIndex+1)));来晚一步
string strout = Regex.Split(strin, ".asp", RegexOptions.IgnoreCase)[0];
strout = strout.Split('/')[strout.Split('/').Length - 1];
System.IO.Path.GetFileNameWithoutExtension(Request.Url.AbsoluteUri)
string strin = "http://community.csdn.net/PostNew.asp?ID=5201";
string fileName = System.IO.Path.GetFileNameWithoutExtension(strin);