0

i have code like this in my businesslogic class:

    if (userList != null) {
         pass = userList.Password;
    }
    else
    {
          var context = new RequestContext(
          new HttpContextWrapper(System.Web.HttpContext.Current),
          new RouteData());
          var urlHelper = new UrlHelper(context);
          var url = urlHelper.Action("Login", "Account");
          // how to throw tempdata like this to: TempData["message"] = "Error";
          System.Web.HttpContext.Current.Response.Redirect(url);
      }

can i possible to throw tempdata from businesslogic class to controller?

Ade Zaenudin
  • 31
  • 1
  • 11
  • which one is "your business logic class"? What's this code? Please, don't tell me it is your business logic – Leo Jun 10 '14 at 04:12
  • sorry i can't copy all my code here, this code to check user collection in my class (public class AdminMemberProvider:MembershipProvider). this code occur in method: public override bool ValidateUser(string username, string password), this logic if userList null i want to redirect to accountcontroller-View(Login). – Ade Zaenudin Jun 10 '14 at 04:28
  • i use this code but doesnt wont create tempdata in accountcontroller, AccountController accountCtrl = new AccountController(); accountCtrl .TempData["tempMessage"] = "test";System.Web.HttpContext.Current.Response.Redirect(url); – Ade Zaenudin Jun 10 '14 at 04:33
  • I've got the feeling that you need to read a tutorial that explains the request life cycle inside an MVC application. You can't do stuff like that, it is so wrong! – Leo Jun 10 '14 at 05:33

0 Answers0