RedirectToAction from Login to root

labjac

New member
Joined
May 26, 2022
Messages
1
Programming Experience
1-3
Hallo

Hope all are well.

I'm new to the web development and need some assistance please. I'm trying to redirect from Login page to a Dashboard in the root folder, but not sure how to get this done.

RedirectTree.PNG


RedirectToAction:
 public ActionResult Index (UserDTO model)
        {

            if (ModelState.IsValid)
            {
                UserDTO user = userbll.GetUserWithUsernameAndPassword(model);

                if (user.ID != 0)
                {
                    UserStatic.UserID = user.ID;
                    UserStatic.isAdmin = user.isAdmin;
                    UserStatic.NameSurname = user.Name;
                    UserStatic.ImagePath = user.ImagePath;

                    LogBLL.AddLog(General.ProcessType.Login, General.TablesName.Login, 12);

                    //return RedirectToAction("Index","DashBoard");
                   [B][I] return RedirectToAction("Index", "~/DashBoard");[/I][/B]
                    //return RedirectToAction("Index", "Post");
                }
                else
                return View(model);
            }
            else
                return View(model);           
        }
 

Skydiver

Staff member
Joined
Apr 6, 2019
Messages
5,251
Location
Chesapeake, VA
Programming Experience
10+
What behavior or error were you getting when you used the commented line 17 instead of your current line 18?
 
Top Bottom