从动态网址获取文件名 [英] Fetching a file name from a dynamic URL

查看:226
本文介绍了从动态网址获取文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨.

我有一个动态URL(例如http://www.xyz.com/a?bcdefghijk),该URL重定向到特定的图像文件(http://www.xyz.com/images/1.gif或
http://www.xyz.com/images/2.gif).是否
任何人都有任何想法如何获取最终图像文件名?
在此先谢谢您.

Hi.

I have a dynamic URL (e.g. http://www.xyz.com/a?bcdefghijk) that redirects to a specific image file (http://www.xyz.com/images/1.gif OR
http://www.xyz.com/images/2.gif) under certain circumstances. Does
anyone have any ideas how I can get that final image filename ?
Thanks in advance.

推荐答案

我认为这会为您提供帮助.

字符串路径文本="http://www.xyz.com/images/1.gif";
字符串文件名= System.IO.Path.GetFileName(Pathtext);
I think this Will help you.

String Pathtext = "http://www.xyz.com/images/1.gif";
String Filename = System.IO.Path.GetFileName(Pathtext);


这篇关于从动态网址获取文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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