public IActionResult Index(string cate, string month, string key) { ViewBag.blogdal = blogdal; ViewBag.CateNo = cate; ViewBag.Month = month; ViewBag.Key = key; ViewBag.blogmonth = blogdal.GetBlogMonth(); ViewBag.calist = catedal.GetList(""); return(View()); }
public IActionResult Index(string key, string month, string cabh) { ViewBag.blogdal = bdal; ViewBag.calist = cadal.GetList(""); ViewBag.blogmonth = bdal.GetBlogMonth(); ViewBag.search_key = key; ViewBag.search_month = month; ViewBag.search_cabh = cabh; return(View()); }
/// <summary> /// 显示博客 /// </summary> /// <param name="id"></param> /// <returns></returns> public IActionResult Show(int id) { ViewBag.blogdal = dal; ViewBag.calist = cadal.GetList("pbh='01'"); ViewBag.blogmonth = dal.GetBlogMonth(); Model.Blog b = dal.GetModel(id); if (b == null) { return(Content("找不到该博客!")); } return(View(b)); }
public IActionResult Index(string key, string month, string cabh) { ViewBag.blogdal = bdal; ViewBag.calist = cadal.GetList("pbh='01'"); ViewBag.blogmonth = bdal.GetBlogMonth(); ViewBag.search_key = key; ViewBag.search_month = month; ViewBag.search_cabh = cabh; string ip1 = HttpContext.Request.Headers["X-Real-IP"]; //取IP,NGINX中的配置里要写上 //var feature = HttpContext.Features.Get<IHttpConnectionFeature>(); //string ip2 = feature.RemoteIpAddress.ToString(); //string ip3 = HttpContext.Request.Headers["X-Forwarded-For"]; //string all_header = ""; //foreach (var item in HttpContext.Request.Headers.Keys) //{ // all_header += item + " → "+ HttpContext.Request.Headers[item]; //} string ipfile = hostingEnv.WebRootPath + $"{Path.DirectorySeparatorChar}upload{Path.DirectorySeparatorChar}qqwry.dat"; //IP纯真库物理路径 string ipaddress = string.IsNullOrEmpty(ip1)?"": Tool.GetIPAddress(ip1, ipfile); //查IP纯真库 logdal.Insert(new Model.Log { Type = 1, UserId = 0, UserName = "******", Remark = "访客登录 ", Ip = ip1, IpAddress = ipaddress }); return(View()); }