In my _Layout page, I have added following code before @RenderBody()
- @if (Session["UserID"].ToString() != "" || Session["UserID"]!=null)
- {
- if (Session["RoleID"].ToString() == "2")
- {
- //menus here
- }
- }
- else
- {
- Response.Redirect("~/Account/login");
- }
I downt want to call @RenderBody() is Session["UserID"] is empty.
please help me out
Rajanikant HawaldarPosted May 1, 2020, 2:52 AM
Jignesh KumarPosted May 1, 2020, 2:44 AM
Hi,
Your condition is ||. It should be && condition. And ideal way to check null first and rest of condition check later.