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
sandeep kumar
NA
58
12.7k
Sessions: If user listed is not logged in, then redirect.
May 23 2018 12:28 PM
Hi Everyone,
I have problem, If the session user is not the desired user then redirect to homepage.
In my page load I have written below code but it is not working( No Errors, But unable to login other than the given user name in the page load).
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(Session[
"username"
] ==
null
)
{
Response.Redirect(
"Login.aspx"
);
}
Label1.Text =
" "
+ Session[
"username"
];
else
if
(Session[
"username"
] !=
null
) ;
{
Session[
"username"
] = Label1.Text =
"abc"
;
Session[
"username"
] = Label1.Text =
"xyz"
;
}
Response.Redirect(
"error.aspx"
)
Here "abc" & "xyz" are the two users which I dont want to give access to page want to redirect to home page.
Please help me.
Thanks,
Sandeep
Reply
Answers (
1
)
JQuery methods are not working after Update panel post back
Regular Expression for Decimal values