C# 如何通过我的Web应用程序了解其他网站中使用的图像/js的缺席路径
为了翻译该网站,我正在通过htmlaglity pack加载该网站。我想知道网站中引用的/js/image/css的绝对路径。 就像当我查看源代码并单击(../Styles/superfish.css)时,它会给我文件的完整路径(NAMe/Site/Styles/superfish.css) 但是我希望在我的web应用程序中有完整的路径程序 源代码:C# 如何通过我的Web应用程序了解其他网站中使用的图像/js的缺席路径,c#,model-view-controller,C#,Model View Controller,为了翻译该网站,我正在通过htmlaglity pack加载该网站。我想知道网站中引用的/js/image/css的绝对路径。 就像当我查看源代码并单击(../Styles/superfish.css)时,它会给我文件的完整路径(NAMe/Site/Styles/superfish.css) 但是我希望在我的web应用程序中有完整的路径程序 源代码: public ActionResult TransURL(string surl) { html = web.Load(surl); //
public ActionResult TransURL(string surl)
{
html = web.Load(surl);
//taking all the script tag
var nodesScript = (from ele in root.Descendants("script")
select ele);
foreach (var e in nodesScript)
{
string value = e.GetAttributeValue("src", "not found");
//here value is ../Styles/superfish.css
Uri ur = new Uri(surl);
//
Uri ur1= new Uri(ur, Url.Content(value));
}
}
我希望这能帮助你达到你的要求
<link type="text/css" src="@Url.Content("../Styles/superfish.css")" />
向我们展示您的一些代码工作。我希望您不被允许获得有关服务器上绝对路径的知识!我已经上传了代码,url.content没有给出完整的路径