Active InfoActive Info  Display List of Info MembersMemberlist  Search The InfoSearch  HelpHelp
  RegisterRegister  LoginLogin
ASPProtect.NET Authentication Add-On Support Archives (Info Locked Info Locked)
 CJWSoft Support Info : ASPProtect.NET Authentication Add-On Support Archives
Subject Info: session value A d d  -  P o s tAdd P o s t
Author
Message << Prev Info | Next Info >>
njaskot
New User
New User


Joined: August/24/2006
Online Status: Offline
Info: 6
Added: August/24/2006 at 11:01pm | IP Logged Quote njaskot

Hi i am trying to caputure the session variable for the logged in user.

After i login i am directed to the page where i am trying to grab the login name.

It seems that the initial load of the page, the value is not there. However, when i manually refresh the page (f5) the value is there!?

Any idea, what i am doing wrong?

Here are some snippets (C# 2.0)....

aspx.cs page (code behind)
    protected void Page_Load(object sender, EventArgs e)
    {
             if (Session["Username"] != null)
             { Response.Write("Username = " + Session["Username"].ToString() + "<br>"); }
             else
             {
                 Response.Write("sorry.......<br>");
             }
 

    }

aspx page

<%@ Register TagPrefix="aspprotectauthentication" TagName="checkaccess" Src="../protectpage.ascx" %>

and

<html>

<head id="Head1" runat="server">
<aspprotectauthentication:checkaccess CHECKFOR="" GROUPACCESS="" runat="server"></aspprotectauthentication:checkaccess& gt;


First time, it echos 'sorry', after a refresh the page echos 'username = xxxx' ?

Thanks,

Nathan

Back to Top View njaskot's Profile Search for other info by njaskot
 
cwilliams
Admin Group
Admin Group
Avatar
CJWSoft Web Software Developer

Joined: April/06/2004
Online Status: Offline
Info: 1769
Added: August/24/2006 at 11:14pm | IP Logged Quote cwilliams

not really sure...   I know my example protected page gets the info ok..... what happens if you try to grab the session info using the  httpcontext.current like so

HttpContext.Current.Session("Username")


__________________

Best Regards, Christopher Williams www.CJWSoft.com
Back to Top View cwilliams's Profile Search for other info by cwilliams Visit cwilliams's Homepage
 
njaskot
New User
New User


Joined: August/24/2006
Online Status: Offline
Info: 6
Added: August/24/2006 at 11:34pm | IP Logged Quote njaskot

same thing...

i also tried something like

if(!Page.IsPostBack)
            {
                check for session here      
            }

i see that your testprotect.aspx page works...as expected.

i will try looking more closely.  It seems pretty simple.  Do you happen to have a working c# example?

It is just really odd...

I would like to send you the url, and test login,  so you can see, if possible

Back to Top View njaskot's Profile Search for other info by njaskot
 
njaskot
New User
New User


Joined: August/24/2006
Online Status: Offline
Info: 6
Added: August/24/2006 at 11:53pm | IP Logged Quote njaskot

i figured it out...kinda

if i put <% Response.Write("Username = " + Session["Username"].ToString() + "<br>"); %>

in the aspx page it works...the first time it hits the page.

However, like i said, if i put it in the code behind, it doesn't (until the refresh).

So i litery have one saying 'sorry'  (it's not there) and the other showing the value?!

I think i can just work with this...but still is just strange.

any ideas?
Back to Top View njaskot's Profile Search for other info by njaskot
 
cwilliams
Admin Group
Admin Group
Avatar
CJWSoft Web Software Developer

Joined: April/06/2004
Online Status: Offline
Info: 1769
Added: August/25/2006 at 12:37am | IP Logged Quote cwilliams

sorry, no working c# example..

Maybe the pageload is your problem.. maybe pageload technically happens before my control envokes thus the values wouldnt exist

Try just putting a function in your code behind and grabbing it when you need it instead of the page load deal..

__________________

Best Regards, Christopher Williams www.CJWSoft.com
Back to Top View cwilliams's Profile Search for other info by cwilliams Visit cwilliams's Homepage
 
njaskot
New User
New User


Joined: August/24/2006
Online Status: Offline
Info: 6
Added: August/25/2006 at 12:56pm | IP Logged Quote njaskot

i think you are correct.

However, i did a bit of playing around and grabbing it in the front end page will work fine for me.

All looks good, thanks for your help!
Back to Top View njaskot's Profile Search for other info by njaskot
 

Sorry, you can NOT post info.
This info has been locked by a info administrator.

  A d d  -  P o s tAdd P o s t
Printable version Printable version

Info Jump
You cannot add new info in this area
You cannot add to info in this area
You cannot delete your info in this area
You cannot edit your info in this area
You cannot create polls in this area
You cannot vote in polls in this area


Active Server Pages help tutorial how to ASP Help ASP Tutorials ASP Programming ASP Code - ASP Free CJWSoft ASPProtect ASPBanner ASPClassifieds www.aspprotect.com, www.powerasp.com,www.aspclassifieds.com,www.aspphotogallery.com,www.codewanker.com