protected void Page_Load(object sender, EventArgs e) { try { //TextNewsList2.ShowLatestTextNews(100); int Code; string strCode = Request["Code"]; Int32.TryParse(strCode, out Code); if (Code != 0) { BOLNews NewsBOL = new BOLNews(); //PageTools1.ItemCode = Code; //PageTools1.HCEntityCode = 1; vNewsDetail CurNews = NewsBOL.GetNewsByCode(Code); if (CurNews == null) { msgText.MessageTextMode = AKP.Web.Controls.Common.MessageMode.Error; msgText.Text = "No news found"; //pnlShowNews.Visible = false; return; } NewsUrl = CurNews.Url; if (!NewsUrl.StartsWith("http://")) { NewsUrl = "http://" + NewsUrl; } NewsUrl = NewsUrl.Replace("http://https://", "https://"); Response.Redirect(NewsUrl); Response.End(); return; //NewsBOL.UpdateViewCount(Code); Page.Title = CurNews.Title; string FullStory = Tools.FormatString(CurNews.Contents); HtmlMeta metaTitle = (HtmlMeta)Page.Master.FindControl("title"); metaTitle.Attributes["content"] = CurNews.Title.Trim(); HtmlMeta metaURL = (HtmlMeta)Page.Master.FindControl("url"); metaURL.Attributes["content"] = "https://www.khabardaan.ir/N" + CurNews.Code + "_" + Tools.ReplaceSpaceWithUnderline(CurNews.Title) + ".html"; HtmlMeta metaKeywords = (HtmlMeta)Page.Master.FindControl("keywords"); metaKeywords.Attributes["content"] = ""; HtmlMeta metaDescription = (HtmlMeta)Page.Master.FindControl("description"); string BriefStory = Tools.ShowBriefText(FullStory, 1100); ReqUtils Utils = new ReqUtils(); BriefStory = Utils.RemoveTags(BriefStory); metaDescription.Attributes["content"] = BriefStory; if (!string.IsNullOrEmpty(CurNews.PicName)) { HtmlMeta metaImage = (HtmlMeta)Page.Master.FindControl("image"); metaImage.Attributes["content"] = "https://www.khabardaan.ir/Files/News/" + CurNews.PicName; } DateTimeMethods dtm = new DateTimeMethods(); if (Request.UserAgent == "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" || Request.UserAgent == "Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)" || Request.UserAgent == "msnbot/2.0b (+http://search.msn.com/msnbot.htm)._" || Request.UserAgent == "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)" || Request.UserAgent == "Mozilla/5.0 (en-us) AppleWebKit/525.13 (KHTML, like Gecko; Google Web Preview) Version/3.1 Safari/525.13" || Request.UserAgent == "Mozilla/5.0 (compatible; MJ12bot/v1.3.3; http://www.majestic12.co.uk/bot.php?+)" || Request.UserAgent == "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)" || Request.UserAgent == "Mozilla/5.0 (compatible; MJ12bot/v1.4.3; http://www.majestic12.co.uk/bot.php?+)" || Request.UserAgent == "Sogou web spider/4.0(+http://www.sogou.com/docs/help/webmasters.htm#07)" ) { } else { NewsBOL.IncrementVisitCount(Code); } //if (FullStory.Length < 100) //{ // Response.Redirect(CurNews.Url); // return; //} } } catch (Exception err) { //Response.Write(err.Message); } }
protected void Page_Load(object sender, EventArgs e) { try { //TextNewsList2.ShowLatestTextNews(100); int Code; string strCode = Request["Code"]; Int32.TryParse(strCode, out Code); if (Code != 0) { BOLNews NewsBOL = new BOLNews(); //PageTools1.ItemCode = Code; //PageTools1.HCEntityCode = 1; vNewsDetail CurNews = NewsBOL.GetNewsByCode(Code); if (CurNews == null) { msgText.MessageTextMode = AKP.Web.Controls.Common.MessageMode.Error; msgText.Text = "خبری با این کد یافت نشد."; //pnlShowNews.Visible = false; return; } Response.Redirect("~/N" + CurNews.Code + "_" + Tools.ReplaceSpaceWithUnderline(CurNews.Title) + ".html", false); return; NewsUrl = CurNews.Url; //NewsBOL.UpdateViewCount(Code); Page.Title = CurNews.Title; string FullStory = Tools.FormatString(CurNews.Contents); HtmlMeta metaTitle = (HtmlMeta)Page.Master.FindControl("title"); metaTitle.Attributes["content"] = CurNews.Title; HtmlMeta metaURL = (HtmlMeta)Page.Master.FindControl("url"); metaURL.Attributes["content"] = "https://www.khabardaan.ir/news/" + CurNews.Code + ".htm"; HtmlMeta metaKeywords = (HtmlMeta)Page.Master.FindControl("keywords"); metaKeywords.Attributes["content"] = ""; HtmlMeta metaDescription = (HtmlMeta)Page.Master.FindControl("description"); string BriefStory = Tools.ShowBriefText(FullStory, 400); ReqUtils Utils = new ReqUtils(); BriefStory = Utils.RemoveTags(BriefStory); metaDescription.Attributes["content"] = BriefStory; if (!string.IsNullOrEmpty(CurNews.PicName)) { HtmlMeta metaImage = (HtmlMeta)Page.Master.FindControl("image"); metaImage.Attributes["content"] = "https://www.khabardaan.ir/Files/News/" + CurNews.PicName; } DateTimeMethods dtm = new DateTimeMethods(); //lblViewTitle.Text = CurNews.Title; //lblViewNewsDate.Text = Tools.ChangeEnc(dtm.GetPersianLongDate((DateTime)CurNews.NewsDate)); //RelatedNews1.NewsCode = Code.ToString(); //KeywordList1.NewsCode = Code.ToString(); //lblViewCount.Text = NewsBOL.GetVisitCount(CurNews.Code);// Tools.ChangeEnc(CurNews.ViewCount.ToString()); //hplResourceName.Text = "جدید ترین خبرهای " + CurNews.Name; //hplResourceName.NavigateUrl = "~/News/Resources/" + CurNews.ResouseSiteCode + ".htm"; //hplCatName.Text = "جدید ترین خبرهای " + CurNews.CatName; //hplCatName.NavigateUrl = "~/News/NewsByCatCode.aspx?Code=" + CurNews.CatCode; //hplRelatedNews.NavigateUrl = "~/News/RelatedNews.aspx?Code=" + CurNews.Code; //hplViewResourceName.NavigateUrl = CurNews.Url; //lblViewCode.Text = CurNews.Code.ToString(); //lblViewNewsTime.Text = Tools.ChangeEnc(CurNews.NewsDate.Value.Hour + ":" + CurNews.NewsDate.Value.Minute); //ShareFaceBook.NavigateUrl = "~/ShareLink.aspx?Media=facebook&LinkUrl=" + Server.UrlEncode("https://www.khabardaan.ir/News/ShowNews.aspx?Code=" + CurNews.Code) + "&LinkTitle=" + Server.UrlEncode(CurNews.Title); //ShareDigg.NavigateUrl = "~/ShareLink.aspx?Media=digg&LinkUrl=" + Server.UrlEncode("https://www.khabardaan.ir/News/ShowNews.aspx?Code=" + CurNews.Code) + "&LinkTitle=" + Server.UrlEncode(CurNews.Title); //ShareTwitter.NavigateUrl = "~/ShareLink.aspx?Media=twitter&LinkUrl=" + Server.UrlEncode("https://www.khabardaan.ir/News/ShowNews.aspx?Code=" + CurNews.Code) + "&LinkTitle=" + Server.UrlEncode(CurNews.Title); //rptResourceNewsList.DataSource = NewsBOL.GetLatestNewsByResourceCode((int)CurNews.ResouseSiteCode, 4, 1); //rptResourceNewsList.DataBind(); //rptMostVisitedNews.DataSource = NewsBOL.GetMostVisitedTextNews(5, 1, 100); //rptMostVisitedNews.DataBind(); //rptCatNews.DataSource = NewsBOL.GetNewsByCatCode((int)CurNews.CatCode, 4, 1); //rptCatNews.DataBind(); //rptRelatedNews.DataSource = NewsBOL.GetRelatedNews((int)CurNews.Code, 4, 1); //rptRelatedNews.DataBind(); //if (rptRelatedNews.Items.Count == 0) // pnlRelatedNews.Visible = false; BOLNewsKeywords NewsKeywordsBOL = new BOLNewsKeywords(CurNews.Code); //rptKeywords.DataSource = NewsKeywordsBOL.GetTopKeywords(CurNews.Code, 3); //rptKeywords.DataBind(); if (Request.UserAgent == "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" || Request.UserAgent == "Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)" || Request.UserAgent == "msnbot/2.0b (+http://search.msn.com/msnbot.htm)._" || Request.UserAgent == "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)" || Request.UserAgent == "Mozilla/5.0 (en-us) AppleWebKit/525.13 (KHTML, like Gecko; Google Web Preview) Version/3.1 Safari/525.13" || Request.UserAgent == "Mozilla/5.0 (compatible; MJ12bot/v1.3.3; http://www.majestic12.co.uk/bot.php?+)" || Request.UserAgent == "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)" || Request.UserAgent == "Mozilla/5.0 (compatible; MJ12bot/v1.4.3; http://www.majestic12.co.uk/bot.php?+)" || Request.UserAgent == "Sogou web spider/4.0(+http://www.sogou.com/docs/help/webmasters.htm#07)" ) { } else { NewsBOL.IncrementVisitCount(Code); } if (FullStory.Length < 100) { Response.Redirect(CurNews.Url); return; } } } catch (Exception err) { BOLErrorLogs ErrorLogsBOL = new BOLErrorLogs(); ErrorLogsBOL.Insert(err.Message, DateTime.Now, Request.Url.AbsolutePath, "ShowExternalNews::Load"); } }
protected void Page_Load(object sender, EventArgs e) { try { int Code; string strCode = Request["Code"]; Int32.TryParse(strCode, out Code); if (Code != 0) { BOLNews NewsBOL = new BOLNews(); vNewsDetail CurNews = NewsBOL.GetNewsByCode(Code); //NewsBOL.UpdateViewCount(Code); lblViewTitle.Text = CurNews.Title; Page.Title = CurNews.Title; string FullStory = Tools.FormatString(CurNews.Contents); if (FullStory.IndexOf("<br />") == -1) { lblViewContents.Text = GenParagraph(FullStory); } else { lblViewContents.Text = FullStory; } DateTimeMethods dtm = new DateTimeMethods(); lblViewNewsDate.Text = Tools.ChangeEnc(dtm.GetPersianLongDate((DateTime)CurNews.NewsDate)); if (!string.IsNullOrEmpty(CurNews.PicName)) { imgPicName.ImageUrl = "https://www.khabardaan.ir/Files/News/" + CurNews.PicName; } else { pnlPic.Visible = false; } //lblViewCount.Text = Tools.ChangeEnc( CurNews.ViewCount.ToString()); lblViewCount.Text = NewsBOL.GetVisitCount(CurNews.Code);// Tools.ChangeEnc(CurNews.ViewCount.ToString()); hplViewResourceName.Text = CurNews.Name; hplViewResourceName.NavigateUrl = CurNews.Url; lblViewCode.Text = CurNews.Code.ToString(); lblViewNewsTime.Text = Tools.ChangeEnc(CurNews.NewsDate.Value.Hour + ":" + CurNews.NewsDate.Value.Minute); if (Request.UserAgent == "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" || Request.UserAgent == "Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)" || Request.UserAgent == "msnbot/2.0b (+http://search.msn.com/msnbot.htm)._" || Request.UserAgent == "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)" || Request.UserAgent == "Mozilla/5.0 (en-us) AppleWebKit/525.13 (KHTML, like Gecko; Google Web Preview) Version/3.1 Safari/525.13" || Request.UserAgent == "Mozilla/5.0 (compatible; MJ12bot/v1.3.3; http://www.majestic12.co.uk/bot.php?+)" || Request.UserAgent == "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)" || Request.UserAgent == "Mozilla/5.0 (compatible; MJ12bot/v1.4.3; http://www.majestic12.co.uk/bot.php?+)" || Request.UserAgent == "Sogou web spider/4.0(+http://www.sogou.com/docs/help/webmasters.htm#07)" ) { } else { NewsBOL.IncrementVisitCount(Code); } } } catch { } }
protected void Page_Load(object sender, EventArgs e) { try { int Code; string strCode = Request["Code"]; Int32.TryParse(strCode, out Code); if (Code != 0) { BOLNews NewsBOL = new BOLNews(); //PageTools1.ItemCode = Code; //PageTools1.HCEntityCode = 1; vNewsDetail CurNews = NewsBOL.GetNewsByCode(Code); if (CurNews == null) { msgText.MessageTextMode = AKP.Web.Controls.Common.MessageMode.Error; msgText.Text = "No news found."; pnlShowNews.Visible = false; return; } strNewsCode = CurNews.Code.ToString(); Tools.SetLink("lnkCanonical", "https://www.khabardaan.ir/" + "/News/" + CurNews.Code + ".html"); Tools.SetMeta("keywords", CurNews.Title); Tools.SetMeta("description", CurNews.Title); Tools.SetMeta("twittercard", CurNews.Title); Tools.SetMeta("twittertitle", CurNews.Title); Tools.SetMeta("twitterdescription", CurNews.Title); Tools.SetMeta("ogtitle", CurNews.Title); Tools.SetMeta("ogurl", "https://www.khabardaan.ir/" + "/News/" + CurNews.Code + "_" + Tools.ReplaceSpaceWithUnderline(CurNews.Title) + ".html"); Tools.SetMeta("twitterimagesrc", ""); if (!string.IsNullOrEmpty(CurNews.PicName)) { Tools.SetMeta("ogimage", "https://static.parset.com/Files/News/" + CurNews.PicName); } Tools.SetMeta("ogdescription", CurNews.Title); //NewsBOL.UpdateViewCount(Code); lblViewTitle.Text = CurNews.Title; Page.Title = CurNews.Title + " - خبردان"; ReqUtils Utils = new ReqUtils(); string FullStory = CurNews.Contents; FullStory = Utils.RemoveTags(FullStory); FullStory = Tools.FormatString(FullStory); FullStory = Tools.ShowBriefText(FullStory, 3000) + "..."; FullStory = FullStory.Replace("<img ", "<img class=\"img-responsive\" "); //if (FullStory.IndexOf("<br />") == -1) //{ // if(FullStory.IndexOf("<img ") == -1) // lblViewContents.Text = GenParagraph(FullStory); // else // lblViewContents.Text = CorrectEnters(FullStory); //} //else // lblViewContents.Text = FullStory; DataTable dtNewsImages = new Converter <NewsImages>().ToDataTable(NewsBOL.GetNewsImages(CurNews.Code)); lblViewContents.Text = GenParagraph(FullStory, dtNewsImages); DateTimeMethods dtm = new DateTimeMethods(); lblViewNewsDate.Text = Tools.ChangeEnc(dtm.GetPersianDate((DateTime)CurNews.NewsDate)); if (!string.IsNullOrEmpty(CurNews.PicName)) { imgPicName.ImageUrl = CurNews.ImgUrl;// "https://www.khabardaan.ir/Files/News/" + CurNews.PicName; imgPicName.ToolTip = CurNews.Title; } else { pnlPic.Visible = false; } RelatedNews1.NewsCode = Code.ToString(); KeywordList1.NewsCode = Code.ToString(); lblViewCount.Text = Tools.ChangeEnc(NewsBOL.GetVisitCount(CurNews.Code)); hplViewResourceName.Text = CurNews.Name; hplMoreFull.NavigateUrl = hplViewResourceName.NavigateUrl = CurNews.Url; //"https://www.khabardaan.ir/N" + CurNews.Code + "_" + Tools.ReplaceSpaceWithUnderline(CurNews.Title) + ".html"; lblViewCode.Text = CurNews.Code.ToString(); string strNewsHour = CurNews.NewsDate.Value.Hour.ToString(); if (strNewsHour.Length == 1) { strNewsHour = "0" + strNewsHour; } string strNewsMinute = CurNews.NewsDate.Value.Minute.ToString(); if (strNewsMinute.Length == 1) { strNewsMinute = "0" + strNewsMinute; } lblViewNewsTime.Text = Tools.ChangeEnc(strNewsHour + ":" + strNewsMinute); News3Col1.LoadPicNews(); //rptNewsImages.DataSource = NewsBOL.GetNewsImages(CurNews.Code); //rptNewsImages.DataBind(); //rptImages.DataSource = NewsBOL.GetSmallRelatedNews(CurNews.Code, 20, 1); //rptImages.DataBind(); //int CatCode = (int)CurNews.CatCode; //switch (CatCode) //{ // case 1: // { // lblCatTitle.Text = "اجتماعي "; // break; // } // case 2: // { // lblCatTitle.Text = "اقتصادي"; // break; // } // case 3: // { // lblCatTitle.Text = "سياسي"; // break; // } // case 4: // { // lblCatTitle.Text = "ورزشي"; // break; // } // case 5: // { // lblCatTitle.Text = "علمي"; // break; // } // case 6: // { // lblCatTitle.Text = "فرهنگي"; // break; // } // case 7: // { // lblCatTitle.Text = "ادب و هنر"; // break; // } // case 8: // { // lblCatTitle.Text = "بينالملل"; // break; // } // case 9: // { // lblCatTitle.Text = "حوادث"; // break; // } // default: // break; //} //lblCatTitle.Text = "آخرین خبرهای " + lblCatTitle.Text ; //NewsList1.ShowPager = false; //NewsList1.ShowNewsByCatCode((int)CurNews.CatCode, null); if (Request.UserAgent == "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" || Request.UserAgent == "Mozilla/5.0 (compatible; Yahoo! Slurp; http://help.yahoo.com/help/us/ysearch/slurp)" || Request.UserAgent == "msnbot/2.0b (+http://search.msn.com/msnbot.htm)._" || Request.UserAgent == "Mozilla/5.0 (compatible; bingbot/2.0; +http://www.bing.com/bingbot.htm)" || Request.UserAgent == "Mozilla/5.0 (en-us) AppleWebKit/525.13 (KHTML, like Gecko; Google Web Preview) Version/3.1 Safari/525.13" || Request.UserAgent == "Mozilla/5.0 (compatible; MJ12bot/v1.3.3; http://www.majestic12.co.uk/bot.php?+)" || Request.UserAgent == "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)" || Request.UserAgent == "Mozilla/5.0 (compatible; MJ12bot/v1.4.3; http://www.majestic12.co.uk/bot.php?+)" || Request.UserAgent == "Sogou web spider/4.0(+http://www.sogou.com/docs/help/webmasters.htm#07)" ) { } else { NewsBOL.IncrementVisitCount(Code); } //if (FullStory.Length < 100) //{ // Response.Redirect(CurNews.Url); // return; //} //SmallAdsList1.ShowAdsByNewsCode(Code); //dtlRelatedPicNews.DataSource = NewsBOL.GetRelatedPicNews(Code); //dtlRelatedPicNews.DataBind(); //ProductsDataContext pdc = new ProductsDataContext(); //vRandPayeganGood CurRandBanner = pdc.vRandPayeganGoods.SingleOrDefault(); //if (CurRandBanner != null) //{ // hplPBanner.ImageUrl = CurRandBanner.strHBannerURL.Trim(); // hplPBanner.NavigateUrl = "http://forosh.biz/Detail.aspx?q=" + CurRandBanner.strGoodCode.Trim() + "&s=9144"; //} //CurRandBanner = pdc.vRandPayeganGoods.SingleOrDefault(); //if (CurRandBanner != null) //{ // hplPBanner2.ImageUrl = CurRandBanner.strHBannerURL.Trim(); // hplPBanner2.NavigateUrl = "http://forosh.biz/Detail.aspx?q=" + CurRandBanner.strGoodCode.Trim() + "&s=9144"; //} } } catch (Exception err) { BOLErrorLogs ErrorLogsBOL = new BOLErrorLogs(); ErrorLogsBOL.Insert(err.Message, DateTime.Now, Request.Url.AbsolutePath, "ShowNews::Load"); } }
protected void Page_Load(object sender, EventArgs e) { try { switch (_catCode) { case 1: { lblCatTitle.Text = "اجتماعي"; break; } case 2: { lblCatTitle.Text = "اقتصادي"; break; } case 3: { lblCatTitle.Text = "سياسي"; break; } case 4: { lblCatTitle.Text = "ورزشي"; break; } case 5: { lblCatTitle.Text = "علمي"; break; } case 6: { lblCatTitle.Text = "فرهنگي"; break; } case 7: { lblCatTitle.Text = "ادب و هنر"; break; } case 8: { lblCatTitle.Text = "بينالملل"; break; } default: break; } if (!Page.IsPostBack) { hplMore.NavigateUrl = "~/News/NewsByCatCode.aspx?Code=" + _catCode; BOLNews NewsBOL = new BOLNews(); IQueryable <vLatestPicNews> CurNewsList = NewsBOL.GetTopPicNews(_catCode); if (CurNewsList.Count() == 1) { vLatestPicNews CurNews = CurNewsList.First(); vNewsDetail CurNewsFull = NewsBOL.GetNewsByCode(CurNews.Code); ImgTopNews.ImageUrl = CurNews.ImgUrl;// "~/Files/News/" + CurNews.PicName; hplTopNewsTitle.NavigateUrl = hplTopNews.NavigateUrl = "~/FaNews/" + CurNews.Code + "_" + Tools.ConvertFarsiToPingilish(CurNews.Title) + ".html"; hplResource.NavigateUrl = "~/NR" + CurNews.ResouseSiteCode + "_" + Tools.ReplaceSpaceWithUnderline(CurNews.ResourceName) + ".html"; hplResource.Text = CurNews.ResourceName; Tools tools = new Tools(); hplTopNewsTitle.Text = CurNews.Title; lblTopNewsStory.Text = Tools.ShowBriefText(tools.RemoveTags(CurNewsFull.Contents), 120) + "..."; rptNews.DataSource = NewsBOL.GetPicNews(_catCode, CurNews.Code, 4); rptNews.DataBind(); } } } catch (Exception err) { BOLErrorLogs ErrorLogsBOL = new BOLErrorLogs(); ErrorLogsBOL.Insert(err.Message, DateTime.Now, Request.Url.AbsolutePath, "News_Default::Load"); } }