public ActionResult Index()
{
ViewData["datas"] = ss();
return View();
}
List<string> dataList = new List<string>();
private List<string> ss()
{
string Site = "http://shiftdelete.net/";
WebClient client = new WebClient();
Stream data = client.OpenRead(Site);
StreamReader reader = new StreamReader(data, Encoding.GetEncoding("utf-8"));
string datas = reader.ReadToEnd();
string pattern3 = "<a.*?href=.*?>(.*?(<img.*?>).*?)</a>";
MatchCollection mathcollection = System.Text.RegularExpressions.Regex.Matches(datas, pattern3);
foreach (Match match in mathcollection)
{
if (match.Value.ToString().Contains("<img"))
dataList.Add(match.Value);
}
return dataList;
}
//******************************************//
index sayfamız
<h2>Index</h2>
@{
List<string> datas = (List<string>)ViewData["datas"];
foreach(string s in datas.ToList())
{
<hr />
<label>@s.ToString()</label>
}
}