问题描述
如题!如何得到一个url的绝对路径(说明是C#应用程序。不是web)
解决方案
解决方案二:
Application.StartupPath;????stringstrAppPath=Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName);你说的url是哪个?还是DriveInfo.GetDrives();这个????取得你电脑上的所有磁盘信息?
解决方案三:
说一个网站url
解决方案四:
同意一楼的
解决方案五:
WebResponse.ResponseUri.AbsoluteUri;EncodingmyEncoding=Encoding.GetEncoding("gb2312");stringparam="filename=aaa.txt";//HttpUtility.UrlEncode("wd",myEncoding)+"="+HttpUtility.UrlEncode("123",myEncoding);byte[]postBytes=Encoding.ASCII.GetBytes(param);HttpWebRequestreq=(HttpWebRequest)HttpWebRequest.Create("http://www.baidu.com/s?wd=123");//HttpWebRequestreq=(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;WebProxypor=WebProxy.GetDefaultProxy();por.Credentials=newSystem.Net.NetworkCredential("zxd","123456");req.Proxy=por;using(StreamreqStream=req.GetRequestStream()){reqStream.Write(postBytes,0,postBytes.Length);}byte[]data=newbyte[1024*10];using(WebResponsewr=req.GetResponse()){//在这里对接收到的页面内容进行处理stringherders=wr.Headers.ToString();wr.GetResponseStream().Read(data,0,data.Length);wr.ResponseUri.AbsoluteUri;}要是这样不是的话我就没办法了
解决方案六:
不可以