如何得到一个url的绝对路径(说明是C#应用程序。不是web)

qzoning 2008-07-09 10:11:22
如题!
如何得到一个url的绝对路径(说明是C#应用程序。不是web)
...全文
125 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
qzoning 2008-07-09
  • 打赏
  • 举报
回复
不可以

ericzhangbo1982111 2008-07-09
  • 打赏
  • 举报
回复
WebResponse.ResponseUri.AbsoluteUri;


Encoding myEncoding = Encoding.GetEncoding("gb2312");
string param = "filename=aaa.txt";//HttpUtility.UrlEncode("wd", myEncoding) + "=" + HttpUtility.UrlEncode("123", myEncoding);

byte[] postBytes = Encoding.ASCII.GetBytes(param);

HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create("http://www.baidu.com/s?wd=123");
//HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create("http://www.codeproject.com/KB/cs/giospdfsplittermerger/GiosPdfSplitterMerger.zip");
req.Method = "post";
req.ContentType = "application/x-www-form-urlencoded;charset=gb2312";
req.ContentLength = postBytes.Length;
WebProxy por = WebProxy.GetDefaultProxy();
por.Credentials = new System.Net.NetworkCredential("zxd", "123456");
req.Proxy = por;
using (Stream reqStream = req.GetRequestStream())
{
reqStream.Write(postBytes, 0, postBytes.Length);
}
byte[] data = new byte[1024 * 10];
using (WebResponse wr = req.GetResponse())
{
//在这里对接收到的页面内容进行处理
string herders = wr.Headers.ToString();

wr.GetResponseStream().Read(data, 0, data.Length);
wr.ResponseUri.AbsoluteUri;

}
要是这样不是的话 我就没办法了
caoqing99416210 2008-07-09
  • 打赏
  • 举报
回复
同意一楼的
qzoning 2008-07-09
  • 打赏
  • 举报
回复
说一个网站url
ericzhangbo1982111 2008-07-09
  • 打赏
  • 举报
回复
Application.StartupPath;????
string strAppPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);

你说的url是哪个?

还是
DriveInfo.GetDrives(); 这个????取得你电脑上的所有磁盘信息?

110,538

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧