i've some web user controls in one folder and web pages in some other
folder.
and i've included header web user control in all my web pages.
and in that user control wrote code to get the logged in user details to be
displayed in header.
In login user control, the logged in userid was stored in a session.
in one of web pages i'm retrieving the values based on the value stored in
session i set in login control.
and when i put cooment to the code in header control then the value is
maintained in session, if i remove comments then it is not storing any data
in session.
whats the problem with my code?
Thanks And Regards
Yoshitha.Dear Gurunadh,
Just Make sure you are not overriding the session variable in the
Header control.
A user controls page load event is raised after page's pageload event
is raised. so if you store or clear session in user control it will
override the value of the page's code.
But it will be helpful if you provide sample code in header control.
Thanks
Md. Masudur Rahman
www.kaz.com.bd
KAZ Software Ltd.
Software outsourcing made simple...
Gurunadh wrote:
Quote:
Originally Posted by
Hi
>
i've some web user controls in one folder and web pages in some other
folder.
>
and i've included header web user control in all my web pages.
and in that user control wrote code to get the logged in user details to be
displayed in header.
>
In login user control, the logged in userid was stored in a session.
>
in one of web pages i'm retrieving the values based on the value stored in
session i set in login control.
>
and when i put cooment to the code in header control then the value is
maintained in session, if i remove comments then it is not storing any data
in session.
>
whats the problem with my code?
>
Thanks And Regards
Yoshitha.
Hi Rahman
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
if(! IsPostBack)
{
ePortalDataBase db=new ePortalDataBase();
OleDbConnection con;
con=db.openconnection();
con.Open ();
if(db.RunQuery("Select aliasname,sitetitle from EL_PortalRegistration where
siteaddress='siteadress' "))
{
while(db.result.Read())
{
lblUser.Text=db.result.GetValue(0).ToString() ;
lblTitle.Text=db.result.GetValue(1).ToString() ;
}
}
con.Close();
}
private void btnSignOut_Click(object sender, System.EventArgs e)
{
Session.Abandon();
Server.Transfer("default.aspx");
}
this is the code i've written in header control
and this code i've writen in login control
private void btnLogin_Click(object sender, System.EventArgs e)
{
Session["EmailId"]=txtEmailId.Text;
Response.Redirect("Eportal_Courses.aspx") ;
}
thanks and REgards
Yoshitha
"Masudur" <munnacs@.gmail.comwrote in message
news:1164613193.483588.194400@.h54g2000cwb.googlegr oups.com...
Quote:
Originally Posted by
Dear Gurunadh,
>
Just Make sure you are not overriding the session variable in the
Header control.
A user controls page load event is raised after page's pageload event
is raised. so if you store or clear session in user control it will
override the value of the page's code.
>
But it will be helpful if you provide sample code in header control.
>
Thanks
>
Md. Masudur Rahman
www.kaz.com.bd
KAZ Software Ltd.
Software outsourcing made simple...
>
Gurunadh wrote:
Quote:
Originally Posted by
>Hi
>>
>i've some web user controls in one folder and web pages in some other
>folder.
>>
>and i've included header web user control in all my web pages.
>and in that user control wrote code to get the logged in user details to
>be
>displayed in header.
>>
>In login user control, the logged in userid was stored in a session.
>>
>in one of web pages i'm retrieving the values based on the value stored
>in
>session i set in login control.
>>
>and when i put cooment to the code in header control then the value is
>maintained in session, if i remove comments then it is not storing any
>data
>in session.
>>
>whats the problem with my code?
>>
>Thanks And Regards
>Yoshitha.
>
0 comments:
Post a Comment