more than 1 per row?

more than 1 per row?

am 19.03.2007 05:49:57 von jeff

Hey gang.
I know this is probably an easy solution, but I don't remember how to do it.

I have this code;

<%
If rstActiveUsers.RecordCount > 0 Then
rstActiveUsers.MoveFirst
Do While Not rstActiveUsers.EOF
var_user1 = session("username") %>

<%=var_user1%>

<% rstActiveUsers.MoveNext
Loop
End If
%>

it shows names like this;

name1
name2
name3

what i would like it to do, is show like this, with 3 across

name1 name2 name3

i think i remember using a mod or something to pull this off.

can someone help??

TIA
Jeff

Re: more than 1 per row?

am 19.03.2007 06:10:03 von jeff

"Jeff" wrote in message
news:45fe0813$0$24707$4c368faf@roadrunner.com...
> Hey gang.
> I know this is probably an easy solution, but I don't remember how to do
> it.
>
> I have this code;
>
> <%
> If rstActiveUsers.RecordCount > 0 Then
> rstActiveUsers.MoveFirst
> Do While Not rstActiveUsers.EOF
> var_user1 = session("username") %>
>
> <%=var_user1%>
>
> <% rstActiveUsers.MoveNext
> Loop
> End If
> %>
>
> it shows names like this;
>
> name1
> name2
> name3
>
> what i would like it to do, is show like this, with 3 across
>
> name1 name2 name3
>
> i think i remember using a mod or something to pull this off.
>
> can someone help??
>
> TIA
> Jeff
>

ok, along with this, i thought i had this working in the global.asa, but it
isn't.

i have this in the asa file:..

id="rstActiveUsers" progid="ADODB.Recordset">





now what i don't have, and am unable to figure out, is how to get the actual
session usernames.

i have the cookie values as session("username") but i am unsure of where to
put that. i have searched the usual tutorial places, but i don't see where
to get that info.

if anyone can help, i would appreciate it.
at least point me to where i can find this.

Re: more than 1 per row?

am 19.03.2007 12:46:32 von reb01501

Jeff wrote:
> > id="rstActiveUsers" progid="ADODB.Recordset">
>


Bad ... no ... HORRIBLE idea. Do NOT store ADO objects in application or
session unless you have modified the server's registry to mark them
"free-threaded" (which will mean they cannot be used for Jet)
http://www.aspfaq.com/2053

Use an array or free-threaded XML document instead.
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Re: more than 1 per row?

am 19.03.2007 12:53:06 von reb01501

Jeff wrote:
> <%
> If rstActiveUsers.RecordCount > 0 Then

I hope this recordset is disconnected and the connection closed ...

> it shows names like this;
>
> name1
> name2
> name3
>
> what i would like it to do, is show like this, with 3 across
>
> name1 name2 name3
>
> i think i remember using a mod or something to pull this off.
>
Look, all you are doing in ASP code is generating a string of html
characters. With that in mind, start by creating the hetml that would
display the data as you desire. Then modify the vbscript code to generate
that html.

In this case, instead of writing cell and row end and start tags after each
record, you would write them after a set number of records. Yes, you could
use mod to do this:
if recordsprocessed % 3 =0 then
'write the end and beginning tags
end if
'write the data

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Re: more than 1 per row?

am 19.03.2007 15:23:00 von reb01501

Jeff wrote:
>> Bad ... no ... HORRIBLE idea. Do NOT store ADO objects in
>> application or session unless you have modified the server's
>> registry to mark them "free-threaded" (which will mean they cannot
>> be used for Jet) http://www.aspfaq.com/2053
>>
>> Use an array or free-threaded XML document instead.
>
> ok, say I am going to totally redo the asa file. Which I am currently
> reading on it with the links you provided,
> I still can't figure how to use the session("username") for anything
> in the asa file. Unless I am missing something, I just don't get it.

I didn't say anything about that because frankly I don't understand the
problem. A session variable contains nothing until you put something
into it. So you have to get the user name from a user and put it into
the session variable.

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Re: more than 1 per row?

am 19.03.2007 15:33:12 von jeff

> Bad ... no ... HORRIBLE idea. Do NOT store ADO objects in application or
> session unless you have modified the server's registry to mark them
> "free-threaded" (which will mean they cannot be used for Jet)
> http://www.aspfaq.com/2053
>
> Use an array or free-threaded XML document instead.

ok, say I am going to totally redo the asa file. Which I am currently
reading on it with the links you provided,
I still can't figure how to use the session("username") for anything in the
asa file. Unless I am missing something, I just don't get it.

Re: more than 1 per row?

am 19.03.2007 16:21:49 von reb01501

Jeff wrote:
> "Bob Barrows [MVP]" wrote in message
> news:e6n8LHjaHHA.2064@TK2MSFTNGP05.phx.gbl...
>> Jeff wrote:
>>>> Bad ... no ... HORRIBLE idea. Do NOT store ADO objects in
>>>> application or session unless you have modified the server's
>>>> registry to mark them "free-threaded" (which will mean they cannot
>>>> be used for Jet) http://www.aspfaq.com/2053
>>>>
>>>> Use an array or free-threaded XML document instead.
>>>
>>> ok, say I am going to totally redo the asa file. Which I am
>>> currently reading on it with the links you provided,
>>> I still can't figure how to use the session("username") for anything
>>> in the asa file. Unless I am missing something, I just don't get it.
>>
>> I didn't say anything about that because frankly I don't understand
>> the problem. A session variable contains nothing until you put
>> something into it. So you have to get the user name from a user and
>> put it into the session variable.
>>

> correct. i do have the session variable ("username") as the login
> name of the user. this gets assigned on the login page. the problem i
> am having, is what to use on the asa page as the session("username")
> so i can work with it there.

You can't. What do you want to do with it in global.asa? There are only
4 event procedures that run in global.asa: application_onstart,
application_onend, session_onstart, and session_onend.
The session_onstart event runs BEFORE that login page runs. The user's
name does not exist at this point. You have to assign it into the
session variable at the point that the login page gets it from the user.

>
> i guess i am not explaining myself to well.
>
> Session.SessionID
>
> that is the actual session id of the user.
True
>
>
> Session.UserName
> i know this isn't the session("username")
True.
Unless you are creating an intranet application that uses Windows
Authentication, the login name has to be gotten from the user.* Unless
you've stored it in a cookie on the user's machine (not very reliable),
it will not be available in global.asa ... and even then, I am not sure
that non-session cookies are available to global.asa. I don't have time
right now to look it up, but you can read through the documentation
here:
http://msdn.microsoft.com/library/en-us/iissdk/html/2c40c3cf -90eb-41ca-ae2a-0ef33a651779.asp

Bob Barrows

* If you ARE using Windows Authentication with Anonymous Access
disabled, the username can be found in
Request.SessionVariables("LOGON_USER")
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Re: more than 1 per row?

am 19.03.2007 16:55:52 von jeff

"Bob Barrows [MVP]" wrote in message
news:e6n8LHjaHHA.2064@TK2MSFTNGP05.phx.gbl...
> Jeff wrote:
>>> Bad ... no ... HORRIBLE idea. Do NOT store ADO objects in
>>> application or session unless you have modified the server's
>>> registry to mark them "free-threaded" (which will mean they cannot
>>> be used for Jet) http://www.aspfaq.com/2053
>>>
>>> Use an array or free-threaded XML document instead.
>>
>> ok, say I am going to totally redo the asa file. Which I am currently
>> reading on it with the links you provided,
>> I still can't figure how to use the session("username") for anything
>> in the asa file. Unless I am missing something, I just don't get it.
>
> I didn't say anything about that because frankly I don't understand the
> problem. A session variable contains nothing until you put something
> into it. So you have to get the user name from a user and put it into
> the session variable.
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.
>
>

correct. i do have the session variable ("username") as the login name of
the user. this gets assigned on the login page. the problem i am having, is
what to use on the asa page as the session("username") so i can work with it
there.

i guess i am not explaining myself to well.

Session.SessionID

that is the actual session id of the user.


Session.UserName
i know this isn't the session("username")

Re: more than 1 per row?

am 19.03.2007 21:40:58 von reb01501

Jeff wrote:
>> You can't. What do you want to do with it in global.asa? There are
>> only 4 event procedures that run in global.asa: application_onstart,
>> application_onend, session_onstart, and session_onend.
>> The session_onstart event runs BEFORE that login page runs. The
>> user's name does not exist at this point. You have to assign it into
>> the session variable at the point that the login page gets it from
>> the user.
>>
>
> ok. then maybe i need to work this with a database. and grab the logon
> username.
>
> the only problem i can see, which may or may not be a problem, is
> removing the name in the db once the session is closed.
> i think i can write a code that checks the login time, and sets any
> name in there to delete after the same time that the session expires.

Well, then, you will want to look at these articles:
http://www.aspfaq.com/show.asp?id=2491
http://classicasp.aspfaq.com/general/what-is-wrong-with-sess ion-onend.html

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Re: more than 1 per row?

am 19.03.2007 21:59:07 von jeff

> You can't. What do you want to do with it in global.asa? There are only
> 4 event procedures that run in global.asa: application_onstart,
> application_onend, session_onstart, and session_onend.
> The session_onstart event runs BEFORE that login page runs. The user's
> name does not exist at this point. You have to assign it into the
> session variable at the point that the login page gets it from the user.
>

ok. then maybe i need to work this with a database. and grab the logon
username.

the only problem i can see, which may or may not be a problem, is removing
the name in the db once the session is closed.
i think i can write a code that checks the login time, and sets any name in
there to delete after the same time that the session expires.

Re: more than 1 per row?

am 19.03.2007 22:52:10 von jeff

thanks Bob,

I really appreciate it