amirreza_.net
چهارشنبه 18 تیر 1393, 20:23 عصر
این کد کنترلر من هست
[Authorize] public class HomeController : Controller
{
private StudentEntities db = new StudentEntities();
//
// GET: /Home/
[AllowAnonymous]
public ActionResult Index()
{
return View(db.Students.ToList());
}
public ActionResult Create()
{
return View();
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create(Student student)
{
if (ModelState.IsValid)
{
db.Students.Add(student);
db.SaveChanges();
return RedirectToAction("Index");
}
return View(student);
}
چی کار کنم وقتی کاربر به Create هدایت شد به جای ارور به صفحه ی لوگین هدایت بشه ؟
اینم به Web.config اضافه کردم :
<authentication mode="Windows"> <forms loginUrl="~/User/Login/" timeout="30000" />
</authentication>
[Authorize] public class HomeController : Controller
{
private StudentEntities db = new StudentEntities();
//
// GET: /Home/
[AllowAnonymous]
public ActionResult Index()
{
return View(db.Students.ToList());
}
public ActionResult Create()
{
return View();
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create(Student student)
{
if (ModelState.IsValid)
{
db.Students.Add(student);
db.SaveChanges();
return RedirectToAction("Index");
}
return View(student);
}
چی کار کنم وقتی کاربر به Create هدایت شد به جای ارور به صفحه ی لوگین هدایت بشه ؟
اینم به Web.config اضافه کردم :
<authentication mode="Windows"> <forms loginUrl="~/User/Login/" timeout="30000" />
</authentication>