I am trying to use it for Login page.
if (Session["UserID"] == null)
Server.Transfer("/Account/Login", true);
But I get The Exception -> Error executing child request /Account/Login.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To use a server transfer method you could look at this from Simon Weaver, but in the context of your question I would use a redirect action instead.
to get it to tell the login controller where to go back to try
note that the Login action will need to take two string arguments, actionToGoBackTo, and controllerToGoBackTo.