parsdarab
جمعه 27 اسفند 1395, 20:29 عصر
سلام من برای ریداریکت کردن از کد زیر استفاده می کنم
public ActionResult Detail(int id, string name)
{
var imodel = _modelService.GetFirstActive(x => x.Id == id);
//هدایت کاربر به صفحه دیگر در صورت نبودن مقاله
if (imodel == null)
{
var temp = new ManageErrorsController();
return temp.RedirectToHomePage();
}
if (string.IsNullOrWhiteSpace(name) || name != model.EShopCommodity.CeoCaption || name.Contains(" "))
{
//Server cannot set status after HTTP headers have been sent
//Response.BufferOutput = true;
Response.Redirect("~/Commodity/" + id + "/" + model.EShopCommodity.Caption.Replace(" ", "-"),true);
}
return View(model);
}
عملیان با موفقیت انجام میشه اما در لاگ الماه که نگا می کنم
همچین لاگی ثبت میشه
System.Web.HttpExceptionServer cannot append header after HTTP headers have been sent.
یه سرچی زدم اما بازم مشکلم حل نشده
http://stackoverflow.com/questions/2383169/server-cannot-set-status-after-http-headers-have-been-sent-iis7-5
public ActionResult Detail(int id, string name)
{
var imodel = _modelService.GetFirstActive(x => x.Id == id);
//هدایت کاربر به صفحه دیگر در صورت نبودن مقاله
if (imodel == null)
{
var temp = new ManageErrorsController();
return temp.RedirectToHomePage();
}
if (string.IsNullOrWhiteSpace(name) || name != model.EShopCommodity.CeoCaption || name.Contains(" "))
{
//Server cannot set status after HTTP headers have been sent
//Response.BufferOutput = true;
Response.Redirect("~/Commodity/" + id + "/" + model.EShopCommodity.Caption.Replace(" ", "-"),true);
}
return View(model);
}
عملیان با موفقیت انجام میشه اما در لاگ الماه که نگا می کنم
همچین لاگی ثبت میشه
System.Web.HttpExceptionServer cannot append header after HTTP headers have been sent.
یه سرچی زدم اما بازم مشکلم حل نشده
http://stackoverflow.com/questions/2383169/server-cannot-set-status-after-http-headers-have-been-sent-iis7-5