我要实现将页面中指定的图片通过程序下载到本地磁盘中。我怎样获取这个图片的路径,后期发布时也不受影响,这个怎样写
问题补充:
WebClient webClient = new WebClient();
string str = @"http://"+System.Web.HttpContext.Current.Request.ServerVariables.Get("HTTP_HOST")+"/road.jpg";
webClient.DownloadFile(@"http://"+System.Web.HttpContext.Current.Request.ServerVariables.Get("HTTP_HOST")+"/road.jpg", @"E:\road.jpg");
object oMissing = System.Reflection.Missing.Value;
object oEndOfDoc = "\\endofdoc "; /* \endofdoc is a predefined bookmark */
object name = "d:\\myfile.doc ";
object Range = System.Reflection.Missing.Value;
//Start Word and create a new document.
Word.Application oWord;
Word.Document oDoc;
oWord = new Word.ApplicationClass();
oWord.Visible = true;
oDoc = oWord.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing);
oWord.Selection.Font.Bold = 1;
oWord.Selection.Font.Size = 18;
oWord.Selection.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter;
oWord.Selection.InlineShapes.AddPicture("E:/road.jpg", ref oMissing, ref oMissing, ref Range);
我是用上述方法实现将图片存储到本地的,但在下面的图片获取中,我想让它灵活些,现在这个获取的不对
string str = @"http://"+System.Web.HttpContext.Current.Request.ServerVariables.Get("HTTP_HOST")+"/road.jpg";