Is it OK - best practise wise - to use the second layer to redirect the user?
For example:
public static void ForceLogin()
{
HttpCookie cookie = HttpContext.Current.Request.Cookies[cookieName];
if (cookie != null)
{
if (Regex.IsMatch(cookie.Value, "^[0-9]+\\.[a-f0-9]+$"))
{
using (EibxDataContext db = new EibxDataContext())
{
int count = db.Logins.Count(l => l.Password == cookie.Value);
if (count == 1)
{
return;
}
}
}
}
HttpContext.Current.Response.Redirect("~/Login.aspx");
}
At the last line, I use the Business/Service Logic Layer to redirect the user to the login page.
Should this be done in the Presentation layer?