110,528
社区成员
发帖
与我相关
我的任务
分享
string contentText = content.Text;
string s = "<img.*(?=src=[\"'](?<src>.+?)[\"']).*>";
Regex re = new Regex("(" + s + ")", RegexOptions.IgnoreCase);
// Response.Write(contentText);
MatchCollection mc = re.Matches(contentText);
foreach (Match m in mc)
{
string filesrc = m.Groups["src"].Value;
Response.Write(filesrc);
if (filesrc.ToLower().IndexOf("www.jobdll.com") < 0 && filesrc.ToLower().IndexOf("http:") >= 0)
{
int statint = filesrc.LastIndexOf("/") + 1;
string fileName = filesrc.Substring((statint < 0 ? 0 : statint));
WebClient wc = new WebClient();
wc.DownloadFile(filesrc, Server.MapPath("/") + "/user/" + dnsName.Value + "/photo/Pic/" + fileName);
contentText = contentText.Replace(filesrc, "/user/" + dnsName.Value + "/photo/Pic/" + fileName);
}
}
<P runat="server" id="img1" align=center> <IMG src="xin_1721204050818109272296.jpg" border=0> </P> ";
string src="数据库的地址";
this.img1.innerhtml+="<IMG src=\""+src+"\" border=0> "