/// <summary> /// 根据用户导入cnblog数据 /// </summary> /// <param name="userName"></param> /// <returns></returns> public string Import(string userName, string iszf, string isshowhome, string isshowmyhome) { userName = userName.Trim(); int blosNumber = 0; JavaScriptSerializer jss = new JavaScriptSerializer(); string url = "http://www.cnblogs.com/" + userName + @"/mvc/blog/sidecolumn.aspx"; HtmlAgilityPack.HtmlWeb htmlweb = new HtmlAgilityPack.HtmlWeb(); HtmlAgilityPack.HtmlDocument document = new HtmlDocument(); var docment = htmlweb.Load(url); string userid = GetCnblogUserId(userName); var liS = docment.DocumentNode.SelectNodes("//*[@id='sidebar_categories']/div[1]/ul/li"); foreach (var item in liS) { var tXPath = item.XPath; var href = item.SelectSingleNode(tXPath + "/a").Attributes["href"].Value; var blogtype = htmlweb.Load(href); //var entrylistItem = blogtype.DocumentNode.SelectNodes("//*[@id='mainContent']/div/div[2]/div[@class='entrylistItem']"); var entrylistItem = blogtype.DocumentNode.SelectNodes("//div[@class='entrylistItem']"); if (null == entrylistItem) //做兼容 { entrylistItem = blogtype.DocumentNode.SelectNodes("//div[@class='post post-list-item']"); // } if (null == entrylistItem) { continue; } foreach (var typeitem in entrylistItem) { var typeitemXPath = typeitem.XPath; var typeitemhrefObj = typeitem.SelectSingleNode(typeitemXPath + "/div/a"); if (null == typeitemhrefObj) //做兼容 { typeitemhrefObj = typeitem.SelectSingleNode(typeitemXPath + "/h2/a"); } var typeitemhref = typeitemhrefObj.Attributes["href"].Value; if (IsAreBlog(typeitemhref)) { continue;//说明这篇文章已经备份过了的 } var bloghtml = htmlweb.Load(typeitemhref); var blogcontextobj = bloghtml.DocumentNode.SelectSingleNode("//*[@id='cnblogs_post_body']");//.InnerHtml; if (blogcontextobj == null) { continue; //有可能是加密文章 } var blogcontext = blogcontextobj.InnerHtml; var blogNameObj = bloghtml.DocumentNode.SelectSingleNode("//*[@id='Header1_HeaderTitle']"); if (null == blogNameObj) { blogNameObj = bloghtml.DocumentNode.SelectSingleNode("//*[@id='lnkBlogTitle']"); } try { blogName = blogNameObj.InnerText; } catch (Exception) { } var blogtitle = bloghtml.DocumentNode.SelectSingleNode("//*[@id='cb_post_title_url']").InnerText; var blogurl = bloghtml.DocumentNode.SelectSingleNode("//*[@id='cb_post_title_url']").Attributes["href"].Value; var blogtypetagurl = "http://www.cnblogs.com/mvc/blog/CategoriesTags.aspx?blogApp=" + userName + "&blogId=" + userid + "&postId=" + typeitemhref.Substring(typeitemhref.LastIndexOf('/') + 1, typeitemhref.LastIndexOf('.') - typeitemhref.LastIndexOf('/') - 1); var blogtag = Blogs.Common.Helper.MyHtmlHelper.GetRequest(blogtypetagurl); var jsonobj = jss.Deserialize <Dictionary <string, string> >(blogtag); if (null == jsonobj) { continue;//如果没有 则返回 (这里只能去 数字.html 不能取那种自定义的url) } var tagSplit = jsonobj["Tags"].Split(','); var blogtagid = new List <int>(); for (int i = 0; i < tagSplit.Length; i++) { if (tagSplit[i].Length >= 1 && tagSplit[i].LastIndexOf('<') >= 1) { var blogtagname = tagSplit[i].Substring(tagSplit[i].IndexOf('>') + 1, tagSplit[i].LastIndexOf('<') - tagSplit[i].IndexOf('>') - 1); blogtagid.Add(this.GetTagId(blogtagname, userName)); } } var categoriesSplit = jsonobj["Categories"].Split(','); var blogtypeid = new List <int>(); for (int i = 0; i < categoriesSplit.Length; i++) { if (categoriesSplit[i].Length >= 1 && categoriesSplit[i].LastIndexOf('<') >= 1) { var blogtypename = categoriesSplit[i].Substring(categoriesSplit[i].IndexOf('>') + 1, categoriesSplit[i].LastIndexOf('<') - categoriesSplit[i].IndexOf('>') - 1); blogtypeid.Add(this.GetTypeId(blogtypename, userName)); } } var blogtimeobj = bloghtml.DocumentNode.SelectSingleNode("//*[@id='post-date']"); var blogtime = ""; if (null != blogtimeobj) { blogtime = blogtimeobj.InnerText; } DateTime?createtime = null; var Outcreatetime = DateTime.Now; if (DateTime.TryParse(blogtime, out Outcreatetime)) { createtime = Outcreatetime; } BlogsBLL blog = new BlogsBLL(); var myBlogTags = new BlogTagsBLL().GetList(t => blogtagid.Contains(t.Id), isAsNoTracking: false).ToList(); //.ToList(); var myBlogTypes = new BLL.BlogTypesBLL().GetList(t => blogtypeid.Contains(t.Id), isAsNoTracking: false).ToList(); //.ToList(); try { var modelMyBlogs = new ModelDB.Blogs() { BlogContent = blogcontext, BlogCreateTime = createtime, BlogTitle = blogtitle, BlogUrl = blogurl, IsDel = false, BlogTags = myBlogTags, BlogTypes = myBlogTypes, UsersId = GetUserId(userName), BlogForUrl = blogurl, IsForwarding = iszf == "true", IsShowMyHome = isshowmyhome == "true", IsShowHome = isshowhome == "true" }; blog.Add(modelMyBlogs); blog.save(); var newtag = string.Empty; try { modelMyBlogs.BlogTags.Where(t => true).ToList().ForEach(t => newtag += t.TagName + " "); var newblogurl = "/" + modelMyBlogs.BlogUsersSet.UserName + "/" + modelMyBlogs.Id + ".html"; SearchResult search = new SearchResult() { flag = modelMyBlogs.UsersId, id = modelMyBlogs.Id, title = blogtitle, clickQuantity = 0, blogTag = newtag, content = getText(blogcontext, document), url = newblogurl }; SafetyWriteHelper <SearchResult> .logWrite(search, PanGuLuceneHelper.instance.CreateIndex); } catch (Exception) { } var postid = blogurl.Substring(blogurl.LastIndexOf('/') + 1); postid = postid.Substring(0, postid.LastIndexOf('.')); testJumonyParser(modelMyBlogs.Id, postid, userName); blosNumber++; } catch (Exception) { throw; } } } if (blosNumber > 0) { Blogs.BLL.Common.GetDataHelper.GetAllTag(); Blogs.BLL.Common.CacheData.GetAllType(true); Blogs.BLL.Common.CacheData.GetAllUserInfo(true); return("成功导入" + blosNumber + "篇Blog"); } return("ok"); }
public async Task <ActionResult> proc() { var json = new StreamReader(Request.Body).ReadToEnd(); var model = JsonConvert.DeserializeObject <JGN_Blogs>(json); if (model.title != null && model.title.Length < 5) { return(Ok(new { status = "error", message = "Please enter title" })); } if (model.description == null || model.description == "" || model.description.Length < 10) { return(Ok(new { status = "error", message = "Please enter proper description" })); } // validate tags if (model.tags != null && Jugnoon.Settings.Configs.FeatureSettings.enable_tags) { if (!TagsBLL.Validate_Tags(model.tags)) { return(Ok(new { status = "error", message = "Tags not validated" })); } // Process tags if (model.tags != "") { TagsBLL.Process_Tags(_context, model.tags, TagsBLL.Types.Blogs, 0); } } var b_settings = new Jugnoon.Blogs.Settings.General(); // process categories int _isapproved = 1; // enable it bydefault if (b_settings.blogPostModeration == 1) { // Moderator Review Required _isapproved = 0; } //XSS CLEANUP string content = ""; if (model.description != null && model.description != "") { content = UGeneral.SanitizeText(model.description); } // normal tags if (b_settings.tag_Processing) { content = BlogScripts.Generate_Auto_Tag_Links(_context, content); } // normal category if (b_settings.category_Processing) { content = BlogScripts.Generate_Auto_Category_Links(_context, content); } // blog banner upload functionality if (model.cover_url != null && model.cover_url != "") { if (model.cover_url.StartsWith("data:image")) { // base 64 image var image_url = model.cover_url.Replace("data:image/png;base64,", ""); byte[] image = Convert.FromBase64String(image_url); // create image name var _title = UtilityBLL.ReplaceSpaceWithHyphin(model.title); if (_title.Length > 15) { _title = _title.Substring(0, 15); } string thumbFileName = _title + Guid.NewGuid().ToString().Substring(0, 8) + ".png"; var path = SiteConfig.Environment.ContentRootPath + DirectoryPaths.BlogsPhotoDirectoryPath; if (System.IO.File.Exists(path + "" + thumbFileName)) { System.IO.File.Delete(path + "" + thumbFileName); } // local storage System.IO.File.WriteAllBytes(path + "" + thumbFileName, image); model.cover_url = await Jugnoon.Helper.Aws.UploadPhoto(_context, thumbFileName, path, Jugnoon.Blogs.Configs.AwsSettings.midthumb_directory_path); } } // normal blog posts upload string _publish_path = ""; // Add information in table var filename = new StringBuilder(); if (model.files.Count > 0) { foreach (var item in model.files) { if (filename.ToString().Length > 0) { filename.Append(","); } filename.Append(item.filename); } } if (filename.ToString() != "") { _publish_path = AwsCloud.UploadPostCover(filename.ToString(), model.userid); } else { _publish_path = filename.ToString(); } if (model.id == 0) { var blg = new JGN_Blogs(); blg.categories = model.categories; blg.userid = model.userid; if (model.title != null) { blg.title = model.title; if (blg.title.Length > 100) { blg.title = blg.title.Substring(0, 99); } } blg.description = content; if (model.tags != null) { blg.tags = model.tags; if (blg.tags.Length > 300) { blg.tags = blg.tags.Substring(0, 299); } } blg.isenabled = 1; // enabled in start blg.isapproved = (byte)_isapproved; blg.picture_caption = model.picture_caption; blg.picture_url = _publish_path; // filename blg.cover_url = model.cover_url; blg = await BlogsBLL.Add(_context, blg); Setup_Item(blg); return(Ok(new { status = "success", record = blg, message = SiteConfig.generalLocalizer["_record_created"].Value })); } else { var blg = new JGN_Blogs(); blg.id = model.id; blg.userid = model.userid; if (model.title != null) { blg.title = model.title; } blg.description = content; if (model.tags != null) { blg.tags = model.tags; } blg.isapproved = (byte)_isapproved; blg.categories = model.categories; blg.picture_caption = model.picture_caption; blg.picture_url = _publish_path; Setup_Item(blg); await BlogsBLL.Update(_context, blg); return(Ok(new { status = "success", record = blg, message = SiteConfig.generalLocalizer["_record_updated"].Value })); } }
/// <summary> /// 根据用户导入cnblog数据 /// </summary> /// <param name="userName"></param> /// <returns></returns> public string Import(string userName, string iszf, string isshowhome, string isshowmyhome) { userName = userName.Trim(); int blosNumber = 0; JavaScriptSerializer jss = new JavaScriptSerializer(); string url = "http://www.cnblogs.com/" + userName + @"/mvc/blog/sidecolumn.aspx"; HtmlAgilityPack.HtmlWeb htmlweb = new HtmlAgilityPack.HtmlWeb(); HtmlAgilityPack.HtmlDocument document = new HtmlDocument(); var docment = htmlweb.Load(url); string userid = GetCnblogUserId(userName); var liS = docment.DocumentNode.SelectNodes("//*[@id='sidebar_categories']/div[1]/ul/li"); foreach (var item in liS) { var tXPath = item.XPath; var href = item.SelectSingleNode(tXPath + "/a").Attributes["href"].Value; var blogtype = htmlweb.Load(href); //var entrylistItem = blogtype.DocumentNode.SelectNodes("//*[@id='mainContent']/div/div[2]/div[@class='entrylistItem']"); var entrylistItem = blogtype.DocumentNode.SelectNodes("//div[@class='entrylistItem']"); if (null == entrylistItem)//做兼容 entrylistItem = blogtype.DocumentNode.SelectNodes("//div[@class='post post-list-item']"); // if (null == entrylistItem) { continue; } foreach (var typeitem in entrylistItem) { var typeitemXPath = typeitem.XPath; var typeitemhrefObj = typeitem.SelectSingleNode(typeitemXPath + "/div/a"); if (null == typeitemhrefObj) //做兼容 typeitemhrefObj = typeitem.SelectSingleNode(typeitemXPath + "/h2/a"); var typeitemhref = typeitemhrefObj.Attributes["href"].Value; if (IsAreBlog(typeitemhref)) continue;//说明这篇文章已经备份过了的 var bloghtml = htmlweb.Load(typeitemhref); var blogcontextobj = bloghtml.DocumentNode.SelectSingleNode("//*[@id='cnblogs_post_body']");//.InnerHtml; if (blogcontextobj == null) continue;//有可能是加密文章 var blogcontext = blogcontextobj.InnerHtml; var blogNameObj = bloghtml.DocumentNode.SelectSingleNode("//*[@id='Header1_HeaderTitle']"); if (null == blogNameObj) blogNameObj = bloghtml.DocumentNode.SelectSingleNode("//*[@id='lnkBlogTitle']"); try { blogName = blogNameObj.InnerText; } catch (Exception) { } var blogtitle = bloghtml.DocumentNode.SelectSingleNode("//*[@id='cb_post_title_url']").InnerText; var blogurl = bloghtml.DocumentNode.SelectSingleNode("//*[@id='cb_post_title_url']").Attributes["href"].Value; var blogtypetagurl = "http://www.cnblogs.com/mvc/blog/CategoriesTags.aspx?blogApp=" + userName + "&blogId=" + userid + "&postId=" + typeitemhref.Substring(typeitemhref.LastIndexOf('/') + 1, typeitemhref.LastIndexOf('.') - typeitemhref.LastIndexOf('/') - 1); var blogtag = Blogs.Common.Helper.MyHtmlHelper.GetRequest(blogtypetagurl); var jsonobj = jss.Deserialize<Dictionary<string, string>>(blogtag); if (null == jsonobj) continue;//如果没有 则返回 (这里只能去 数字.html 不能取那种自定义的url) var tagSplit = jsonobj["Tags"].Split(','); var blogtagid = new List<int>(); for (int i = 0; i < tagSplit.Length; i++) { if (tagSplit[i].Length >= 1 && tagSplit[i].LastIndexOf('<') >= 1) { var blogtagname = tagSplit[i].Substring(tagSplit[i].IndexOf('>') + 1, tagSplit[i].LastIndexOf('<') - tagSplit[i].IndexOf('>') - 1); blogtagid.Add(this.GetTagId(blogtagname, userName)); } } var categoriesSplit = jsonobj["Categories"].Split(','); var blogtypeid = new List<int>(); for (int i = 0; i < categoriesSplit.Length; i++) { if (categoriesSplit[i].Length >= 1 && categoriesSplit[i].LastIndexOf('<') >= 1) { var blogtypename = categoriesSplit[i].Substring(categoriesSplit[i].IndexOf('>') + 1, categoriesSplit[i].LastIndexOf('<') - categoriesSplit[i].IndexOf('>') - 1); blogtypeid.Add(this.GetTypeId(blogtypename, userName)); } } var blogtimeobj = bloghtml.DocumentNode.SelectSingleNode("//*[@id='post-date']"); var blogtime = ""; if (null != blogtimeobj) blogtime = blogtimeobj.InnerText; DateTime? createtime = null; var Outcreatetime = DateTime.Now; if (DateTime.TryParse(blogtime, out Outcreatetime)) createtime = Outcreatetime; BlogsBLL blog = new BlogsBLL(); var myBlogTags = new BlogTagsBLL().GetList(t => blogtagid.Contains(t.Id), isAsNoTracking: false).ToList();//.ToList(); var myBlogTypes = new BLL.BlogTypesBLL().GetList(t => blogtypeid.Contains(t.Id), isAsNoTracking: false).ToList();//.ToList(); try { var modelMyBlogs = new ModelDB.Blogs() { BlogContent = blogcontext, BlogCreateTime = createtime, BlogTitle = blogtitle, BlogUrl = blogurl, IsDel = false, BlogTags = myBlogTags, BlogTypes = myBlogTypes, UsersId = GetUserId(userName), BlogForUrl = blogurl, IsForwarding = iszf == "true", IsShowMyHome = isshowmyhome == "true", IsShowHome = isshowhome == "true" }; blog.Add(modelMyBlogs); blog.save(); var newtag = string.Empty; try { modelMyBlogs.BlogTags.Where(t => true).ToList().ForEach(t => newtag += t.TagName + " "); var newblogurl = "/" + modelMyBlogs.BlogUsersSet.UserName + "/" + modelMyBlogs.Id + ".html"; SearchResult search = new SearchResult() { flag = modelMyBlogs.UsersId, id = modelMyBlogs.Id, title = blogtitle, clickQuantity = 0, blogTag = newtag, content = getText(blogcontext, document), url = newblogurl }; SafetyWriteHelper<SearchResult>.logWrite(search, PanGuLuceneHelper.instance.CreateIndex); } catch (Exception) { } var postid = blogurl.Substring(blogurl.LastIndexOf('/') + 1); postid = postid.Substring(0, postid.LastIndexOf('.')); testJumonyParser(modelMyBlogs.Id, postid, userName); blosNumber++; } catch (Exception) { throw; } } } if (blosNumber > 0) { Blogs.BLL.Common.GetDataHelper.GetAllTag(); Blogs.BLL.Common.CacheData.GetAllType(true); Blogs.BLL.Common.CacheData.GetAllUserInfo(true); return "成功导入" + blosNumber + "篇Blog"; } return "ok"; }
public void ProcessRequest(HttpContext context) { var json = new StreamReader(context.Request.InputStream).ReadToEnd(); var responseMsg = new Dictionary <string, string>(); long PostID = 0; int Type = 0; string UserName = ""; bool IsUpdate = false; long GalleryID = 0; int Status = 0; int isApproved = 0; int OldValue = 0; int NewValue = 0; string Value = ""; string FieldName = ""; int Records = 0; bool isAdmin = false; var _videoobj = new BlogsBLL(); var _ld_video_data = new Dictionary <string, BlogsObject>(); if ((context.Request.Params["action"] != null)) { switch (context.Request.Params["action"]) { case "add": // Authentication if (!context.User.Identity.IsAuthenticated) { responseMsg["status"] = "error"; responseMsg["message"] = "Authentication Failed"; context.Response.Write(responseMsg); return; } if (context.Request.Params["isadmin"] != null) { isAdmin = Convert.ToBoolean(context.Request.Params["isadmin"]); } BlogsBLL.Add(JsonConvert.DeserializeObject <Blogs_Struct>(json), isAdmin); responseMsg["status"] = "success"; responseMsg["message"] = "Operation Commit"; context.Response.Write(responseMsg); break; case "check": if (context.Request.Params["vid"] != null) { PostID = Convert.ToInt64(context.Request.Params["vid"]); } if (context.Request.Params["user"] != null) { UserName = context.Request.Params["user"].ToString(); } if (BlogsBLL.Check(PostID, UserName)) { responseMsg["status"] = "success"; responseMsg["message"] = "Validated"; } else { responseMsg["status"] = "error"; responseMsg["message"] = "Not Validated"; } context.Response.Write(responseMsg); break; // This update is only for pubplishing pending videos (unpublished videos only) case "update": // Authentication if (!context.User.Identity.IsAuthenticated) { responseMsg["status"] = "error"; responseMsg["message"] = "Authentication Failed"; context.Response.Write(responseMsg); return; } BlogsBLL.Update(JsonConvert.DeserializeObject <Blogs_Struct>(json)); responseMsg["status"] = "success"; responseMsg["message"] = "Operation Commit"; context.Response.Write(responseMsg); break; case "delete": var _del_post = JsonConvert.DeserializeObject <Blogs_Struct>(json); BlogsBLL.Delete(_del_post.PostID, _del_post.UserName); break; case "count": if (context.Request.Params["type"] != null) { Type = Convert.ToInt32(context.Request.Params["type"]); } if (context.Request.Params["status"] != null) { Status = Convert.ToInt32(context.Request.Params["status"]); } if (context.Request.Params["approved"] != null) { isApproved = Convert.ToInt32(context.Request.Params["approved"]); } var _Output = new Dictionary <string, int>(); _Output["records"] = BlogsBLL.Count(UserName, Status, isApproved); context.Response.Write(_Output); break; case "update_isenabled": if (context.Request.Params["oval"] != null) { OldValue = Convert.ToInt32(context.Request.Params["oval"]); } if (context.Request.Params["nval"] != null) { NewValue = Convert.ToInt32(context.Request.Params["nval"]); } var _upd_isenabled = JsonConvert.DeserializeObject <Blogs_Struct>(json); BlogsBLL.Update_IsEnabled(_upd_isenabled.PostID, OldValue, NewValue, _upd_isenabled.UserName); responseMsg["status"] = "success"; responseMsg["message"] = "Operation Commit"; context.Response.Write(responseMsg); break; case "update_isapproved": if (context.Request.Params["oval"] != null) { OldValue = Convert.ToInt32(context.Request.Params["oval"]); } if (context.Request.Params["nval"] != null) { NewValue = Convert.ToInt32(context.Request.Params["nval"]); } var _upd_isreviewed = JsonConvert.DeserializeObject <Blogs_Struct>(json); BlogsBLL.Update_IsApproved(_upd_isreviewed.PostID, OldValue, NewValue, _upd_isreviewed.UserName); responseMsg["status"] = "success"; responseMsg["message"] = "Operation Commit"; context.Response.Write(responseMsg); break; case "update_field": if (context.Request.Params["vid"] != null) { PostID = Convert.ToInt32(context.Request.Params["vid"]); } if (context.Request.Params["val"] != null) { Value = context.Request.Params["val"].ToString(); } if (context.Request.Params["field"] != null) { FieldName = context.Request.Params["field"].ToString(); } BlogsBLL.Update_Field(PostID, Value, FieldName); responseMsg["status"] = "success"; responseMsg["message"] = "Operation Commit"; context.Response.Write(responseMsg); break; case "get_field_value": if (context.Request.Params["vid"] != null) { PostID = Convert.ToInt32(context.Request.Params["vid"]); } if (context.Request.Params["field"] != null) { FieldName = context.Request.Params["field"].ToString(); } responseMsg["value"] = BlogsBLL.Get_Field_Value(PostID, FieldName); context.Response.Write(responseMsg); break; case "load_blogs": var _ld_video_json = JsonConvert.DeserializeObject <Blogs_Struct>(json); var _vObject = new BlogsObject() { Data = BlogsBLL.Load_Blogs_V4(_ld_video_json), Count = BlogsBLL.Cache_Count_Blogs_V4(_ld_video_json) }; _ld_video_data["data"] = _vObject; context.Response.Write(_ld_video_data); break; case "load_photos_limit": _ld_video_data["data"] = new BlogsObject() { Data = BlogsBLL.Load_Blogs_Limit(JsonConvert.DeserializeObject <Blogs_Struct>(json)), Count = 0 }; context.Response.Write(_ld_video_data); break; case "fetch_record": if (context.Request.Params["vid"] != null) { PostID = Convert.ToInt32(context.Request.Params["vid"]); } _ld_video_data["data"] = new BlogsObject() { Data = BlogsBLL.Fetch_Blog(PostID), Count = 0 }; context.Response.Write(_ld_video_data); break; case "fetch_sm": if (context.Request.Params["vid"] != null) { PostID = Convert.ToInt32(context.Request.Params["vid"]); } _ld_video_data["data"] = new BlogsObject() { Data = BlogsBLL.Fetch_Blog_SM(PostID), Count = 0 }; context.Response.Write(_ld_video_data); break; case "get_sm_info": if (context.Request.Params["vid"] != null) { PostID = Convert.ToInt32(context.Request.Params["vid"]); } _ld_video_data["data"] = new BlogsObject() { Data = BlogsBLL.Get_SM_Info(PostID), Count = 0 }; context.Response.Write(_ld_video_data); break; case "post_info": if (context.Request.Params["vid"] != null) { PostID = Convert.ToInt32(context.Request.Params["vid"]); } _ld_video_data["data"] = new BlogsObject() { Data = BlogsBLL.Fetch_Post_Info(PostID), Count = 0 }; context.Response.Write(_ld_video_data); break; case "fetch_blog_information": if (context.Request.Params["vid"] != null) { PostID = Convert.ToInt32(context.Request.Params["vid"]); } _ld_video_data["data"] = new BlogsObject() { Data = BlogsBLL.Fetch_Blog_Info(PostID), Count = 0 }; context.Response.Write(_ld_video_data); break; case "archive_list": if (context.Request.Params["type"] != null) { Type = Convert.ToInt32(context.Request.Params["type"]); } if (context.Request.Params["records"] != null) { Records = Convert.ToInt32(context.Request.Params["records"]); } bool isAll = false; if (context.Request.Params["isall"] != null) { isAll = Convert.ToBoolean(context.Request.Params["isall"]); } var _archive = new Dictionary <string, List <Archive_Struct> >(); _archive["data"] = BlogsBLL.Load_Arch_List(Records, isAll); context.Response.Write(_archive); break; } } else { // No action found responseMsg["status"] = "error"; responseMsg["message"] = "No action found"; context.Response.Write(JsonConvert.SerializeObject(responseMsg)); } }