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
Dhimesh Parmar
NA
126
14.6k
I want to Pass Session Name In another page?
Mar 6 2018 12:28 AM
When i click on login button then pass username in my another page?
My Code Like This:
Login Page:
protected
void
Page_Load(
object
sender, EventArgs e)
{
{
if
(Request.QueryString[
"out"
] !=
null
)
{
Session.RemoveAll();
Response.Redirect(
"Login.aspx"
);
}
}
}
protected
void
btnLogin_Click(
object
sender, EventArgs e)
{
DataTable dt =
new
DataTable();
SqlDataAdapter da =
new
SqlDataAdapter(
"select Name from userLogin where Name='"
+ txtUserName.Text +
"' AND Password='"
+ txtUserPassword.Text +
"'"
, @
"Data Source =.\SQLExpress;Initial Catalog = TourPortal; Integrated Security = True"
);
da.Fill(dt);
if
(dt.Rows.Count == 0)
{
msg =
"Please Enter Valid Username And Password"
;
}
else
{
Session.Add(
"UserName"
, dt.Rows[0][0].ToString());
Response.Redirect(
"Dashboard.aspx"
);
}
another Page:
<a href=
"#"
data-toggle=
"dropdown"
aria-expanded=
"false"
>
<span
class
=
"hidden-xs"
>----------Need Session Name---------------<i
class
=
"fa fa-angle-down pull-right"
></i></span>
<img src=
"resources/img/icons/icon-user.png"
class
=
"user-image"
alt=
"User Image"
>
</a>
<ul
class
=
"dropdown-menu user-menu animated flipInY"
>
<li
class
=
"divider"
></li>
<li><a href=
"Default.aspx?out=1"
id=
"logout"
><i
class
=
"ti-power-off"
></i> Log Out</a></li>
</ul>
Reply
Answers (
7
)
jquery popupForm function Onclick() tag <a/> dose not work
cascading dropdown