TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Pravinkumar Birajdar
1.2k
583
108.4k
Session checking in _Layout page in mvc
May 1 2020 2:39 AM
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"
);
}
but still it is not redirecting to login when Session["UserID"] is empty & it is rendering @RenderBody()
I downt want to call @RenderBody() is Session["UserID"] is empty.
please help me out
Reply
Answers (
2
)
server.transfer instead of response.redirect
Mvc master details curd operation EF