// GET: /<controller>/ public IActionResult Index(string key) { ViewData["key"] = key; var db = new MongoDBTool().GetMongoCollection <We7Temp>(); We7Temp data = null; if (MainConfig.IsDev) #pragma warning disable CS0162 // Unreachable code detected { data = db.Find(x => x.We7TempID.Equals(new ObjectId(key))).FirstOrDefault(); } #pragma warning restore CS0162 // Unreachable code detected else { data = db.FindOneAndDelete(x => x.We7TempID.Equals(new ObjectId(key))); } if (data == null) { return(RedirectToAction("Index", "Error")); } ViewData["we7Data"] = data.Data; var jObject = (JObject)JsonConvert.DeserializeObject(data.Data); var uniacid = (string)jObject["uniacid"]; if (!string.IsNullOrEmpty(uniacid)) { HttpContext.Session.PushWe7Data(data.Data); } //hasIdentity = true; return(RedirectToAction("Index", "Merchant")); }
// GET: /<controller>/ public IActionResult Index(string key) { ViewData["key"] = key; var db = new MongoDBTool().GetMongoCollection <We7Temp>(); We7Temp data = null; if (hostingEnvironment.IsDevelopment()) { data = db.Find(x => x.We7TempID.Equals(new ObjectId(key))).FirstOrDefault(); } else { data = db.FindOneAndDelete(x => x.We7TempID.Equals(new ObjectId(key))); } if (data == null) { return(RedirectToAction("Index", "Error")); } ViewData["we7Data"] = data.Data; JObject jObject = (JObject)JsonConvert.DeserializeObject(data.Data); string uniacid = (string)jObject["uniacid"]; if (!string.IsNullOrEmpty(uniacid)) { HttpContext.Session.PushWe7Data(data.Data); } //hasIdentity = true; return(RedirectToAction("Index", "Merchant")); }
// GET: /<controller>/ public IActionResult Index(string key) { if (key == null) { return(new RedirectToActionResult("Index", "WebError", new { errorType = ErrorType.ErrorNoUserOrTimeOut })); } ViewData["key"] = key; var db = new MongoDBTool().GetMongoCollection <We7Temp>(); We7Temp data = null; if (MainConfig.IsDev || hostingEnvironment.IsDevelopment()) { data = db.Find(x => x.We7TempID.Equals(new ObjectId(key))).FirstOrDefault(); } else { data = db.FindOneAndDelete(x => x.We7TempID.Equals(new ObjectId(key))); } if (data == null) { return(new RedirectToActionResult("Index", "WebError", new { errorType = ErrorType.ErrorNoUserOrTimeOut })); } ViewData["we7Data"] = data.Data; JObject jObject = (JObject)JsonConvert.DeserializeObject(data.Data); string uniacid = (string)jObject["uniacid"]; if (!string.IsNullOrEmpty(uniacid)) { HttpContext.Session.PushWe7Data(data.Data); } //hasIdentity = true; //var urlReferrer = HttpContext.Request.Headers["referer"].FirstOrDefault(); //if (urlReferrer!=null) //{ // var urlBase = urlReferrer.ToString(); // HttpContext.SetReferrer(urlBase); //} //HttpContext.SetReferrer(JsonConvert.SerializeObject(HttpContext.Request.Headers)); string preUrl = Request.Headers["Referer"]; if (HttpContext.GetReferrer() == null && preUrl != null) { HttpContext.SetReferrer(preUrl); } return(RedirectToAction("Index", "Merchant")); }