473,324 Members | 2,501 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Response.Write "<b>You are not logged on..............................

I last posted to this group about 6 months ago and was very pleased by the
excellent response I got and the great help offered to me. I am back this
time with another request for your expert help on a bit of ASP code I use on
my windows server 2003 with IIS6 machine.

I would like the code below to display in different colours depending on the
status of the page. I am looking to make the not logged in code appear red
and the logged in code green.

The code:
<%
If Len(Session("UID")) = 0 Then
Response.Write "<b>You are not logged on. If You don't have a username
or password you can register for one by clicking > </b>"
Else
Response.Write "<b>You are logged on as " & Session("UID") & "</b>"
End If
%>

If anyone can help this would be great.

Thank you

malcolm
Oct 7 '05 #1
9 3995
"mallyonline" <ma***********@btinternet.com> wrote:
I would like the code below to display in different colours depending on the
status of the page. I am looking to make the not logged in code appear red
and the logged in code green.

The code:
<%
If Len(Session("UID")) = 0 Then
Response.Write "<b>You are not logged on. If You don't have a username
Response.Write "<b style='color:red'>You are not logged on....or password you can register for one by clicking > </b>"
Else
Response.Write "<b>You are logged on as " & Session("UID") & "</b>"

Response.Write "<b style='color:green'>You are logged on...."

--
Tim Slattery
MS MVP(DTS)
Sl********@bls.gov
Oct 7 '05 #2
<%
'// #ff0000 = red
'// #339900 = green
If Len(Session("UID")) = 0 Then
Response.Write "<b><font color=""#ff0000"">You are not logged on. If
You don't have a username or password you can register for one by clicking
</font></b>" Else
Response.Write "<b><font color=""#339900"">You are logged on as " &
Session("UID") & "</font></b>"
End If
%>
--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"mallyonline" <ma***********@btinternet.com> wrote in message
news:di**********@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com... I last posted to this group about 6 months ago and was very pleased by the
excellent response I got and the great help offered to me. I am back this
time with another request for your expert help on a bit of ASP code I use on my windows server 2003 with IIS6 machine.

I would like the code below to display in different colours depending on the status of the page. I am looking to make the not logged in code appear red and the logged in code green.

The code:
<%
If Len(Session("UID")) = 0 Then
Response.Write "<b>You are not logged on. If You don't have a username
or password you can register for one by clicking > </b>"
Else
Response.Write "<b>You are logged on as " & Session("UID") & "</b>"
End If
%>

If anyone can help this would be great.

Thank you

malcolm

Oct 7 '05 #3
"mallyonline" <ma***********@btinternet.com> wrote in message
news:di**********@nwrdmz02.dmz.ncs.ea.ibs-infra.bt.com...
I last posted to this group about 6 months ago and was very pleased by the
excellent response I got and the great help offered to me. I am back this
time with another request for your expert help on a bit of ASP code I use on my windows server 2003 with IIS6 machine.

I would like the code below to display in different colours depending on the status of the page. I am looking to make the not logged in code appear red and the logged in code green.

The code:
<%
If Len(Session("UID")) = 0 Then
Response.Write "<b>You are not logged on. If You don't have a username
or password you can register for one by clicking > </b>"
Else
Response.Write "<b>You are logged on as " & Session("UID") & "</b>"
End If
%>

If anyone can help this would be great.

Thank you

malcolm


http://www.aspfaq.com/5003 again!
Oct 7 '05 #4
McKirahan wrote:

http://www.aspfaq.com/5003 again!


Where else was this posted?
--
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"
Oct 8 '05 #5
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:eF**************@TK2MSFTNGP15.phx.gbl...
McKirahan wrote:

http://www.aspfaq.com/5003 again!


Where else was this posted?


microsoft.public.inetserver.asp.components
Oct 8 '05 #6

Thank you, It has worked a treat. I wonder if you guy's could also help
with this particular bit of code also related to logon.

Sometimes depending on how i am directed to the logon page the code will
do it's job and other times again it depends on how i get to the logon
page the code fails and i get an error

The code:
<%
' Was this page posted to?
If UCase(Request.ServerVariables("HTTP_METHOD")) = "POST" Then
' If so, check the username/password that was entered.
If ComparePassword(Request("UID"),Request("PWD")) Then
' If comparison was good, store the user name...
Session("UID") = Request("UID")
' ...and redirect back to the original page.
Response.Redirect Session("REFERRER")
End If
End If
%>

The error:
Response object error 'ASP 0158 : 80004005'
Missing URL
/logon/logon.asp, line 11
A URL is required.

Line 11 is this bit of code here so it depends on the REFERRER page.
Response.Redirect Session("REFERRER")

It still loggs me into the protected area as can be seen when a small
inline frame refreshes on the top area of the page with my login
username.
What i would like to do is have some safe code that will maybe just show
me as logged on. But at the same time i do not want to lose the
functionality of the code redirecting to the referrer page.
Again thank you
malcolm


*** Sent via Developersdex http://www.developersdex.com ***
Oct 8 '05 #7
Ensure your session var actually contains a URL .... (there would be alot
more to it to check the URL it contains is actually valid, but this should
give you a start).

sRef =Session("REFERRER")
If Len(sRef) > 0 Then Response.Redirect sRef Else Response.Write "<b>Invalid
Referer:</b> " & sRef

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"malcolm whyte" <ma*********@gmail.com> wrote in message
news:#s*************@tk2msftngp13.phx.gbl...

Thank you, It has worked a treat. I wonder if you guy's could also help
with this particular bit of code also related to logon.

Sometimes depending on how i am directed to the logon page the code will
do it's job and other times again it depends on how i get to the logon
page the code fails and i get an error

The code:
<%
' Was this page posted to?
If UCase(Request.ServerVariables("HTTP_METHOD")) = "POST" Then
' If so, check the username/password that was entered.
If ComparePassword(Request("UID"),Request("PWD")) Then
' If comparison was good, store the user name...
Session("UID") = Request("UID")
' ...and redirect back to the original page.
Response.Redirect Session("REFERRER")
End If
End If
%>

The error:
Response object error 'ASP 0158 : 80004005'
Missing URL
/logon/logon.asp, line 11
A URL is required.

Line 11 is this bit of code here so it depends on the REFERRER page.
Response.Redirect Session("REFERRER")

It still loggs me into the protected area as can be seen when a small
inline frame refreshes on the top area of the page with my login
username.
What i would like to do is have some safe code that will maybe just show
me as logged on. But at the same time i do not want to lose the
functionality of the code redirecting to the referrer page.
Again thank you
malcolm


*** Sent via Developersdex http://www.developersdex.com ***

Oct 8 '05 #8
I have now read and fully understand what you are saying.

Kind Regards
Malcolm
"McKirahan" <Ne**@McKirahan.com> wrote in message
news:Hc********************@comcast.com...
"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcom> wrote in message
news:eF**************@TK2MSFTNGP15.phx.gbl...
McKirahan wrote:
>
> http://www.aspfaq.com/5003 again!


Where else was this posted?


microsoft.public.inetserver.asp.components

Oct 9 '05 #9
Steven,

Thank you for your help.

I think it may have been you who helped me out last time i posted regarding
listing the names of files held in a folder on the server and making the
list appear clickable. This i have now used but appear to have a problem?
When the link is clicked rather than open the said file (.mp3) for playing
in a media player what actually happens is a new browser window tries to
open objFl.Name which obviously it cannot. I have since made some changes to
IIS6

What happens now is i have the server open a new window that allows
directory browsing. This is just a temporary measure to get a list of files
that open in media player. But i would obviously like it if the code would
open a media player possibly even in a new frame :) this would allow me to
see the files and have them play in another frame at the same time.

The code:

<%
Dim objFSO,objFldr,objFl, sPath
sPath = "E:\Inetpub\wwwroot\mp3"
Set objFSO=Server.CreateObject("Scripting.FileSystemOb ject")
Set objFldr=objFSO.GetFolder(sPath)
For Each objFl in objFldr.Files
'Print the name of all files in the test folder

Response.Write "<a href=""mp3/"" target=""I1"">" & objFl.Name & "</a><br />"
Next
Set objFldr=Nothing
Set objFSO=Nothing
%>

If you could help on this i would be much appreciative.

Kind Regards

Malcolm

"Steven Burn" <so*******@in-time.invalid> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Ensure your session var actually contains a URL .... (there would be alot
more to it to check the URL it contains is actually valid, but this should
give you a start).

sRef =Session("REFERRER")
If Len(sRef) > 0 Then Response.Redirect sRef Else Response.Write
"<b>Invalid
Referer:</b> " & sRef

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

"malcolm whyte" <ma*********@gmail.com> wrote in message
news:#s*************@tk2msftngp13.phx.gbl...

Thank you, It has worked a treat. I wonder if you guy's could also help
with this particular bit of code also related to logon.

Sometimes depending on how i am directed to the logon page the code will
do it's job and other times again it depends on how i get to the logon
page the code fails and i get an error

The code:
<%
' Was this page posted to?
If UCase(Request.ServerVariables("HTTP_METHOD")) = "POST" Then
' If so, check the username/password that was entered.
If ComparePassword(Request("UID"),Request("PWD")) Then
' If comparison was good, store the user name...
Session("UID") = Request("UID")
' ...and redirect back to the original page.
Response.Redirect Session("REFERRER")
End If
End If
%>

The error:
Response object error 'ASP 0158 : 80004005'
Missing URL
/logon/logon.asp, line 11
A URL is required.

Line 11 is this bit of code here so it depends on the REFERRER page.
Response.Redirect Session("REFERRER")

It still loggs me into the protected area as can be seen when a small
inline frame refreshes on the top area of the page with my login
username.
What i would like to do is have some safe code that will maybe just show
me as logged on. But at the same time i do not want to lose the
functionality of the code redirecting to the referrer page.
Again thank you
malcolm


*** Sent via Developersdex http://www.developersdex.com ***


Oct 9 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
by: Dr Duck | last post by:
GDay all, Something seems odd to me.... I wrote a simple C# function public void bind(ref object a, ref object b, bool atob) { if(atob) b = a; else
1
by: hifiger2004 | last post by:
Hi Everyone, I have a problem with my classic asp programming. I think I missed something. I encountered logical error an hour ago. And below is one of the lines in my source code wherein I...
4
by: Ed | last post by:
Hi, guys, Here is a simple template class definition: template <typename T = int> class Point { public: T X; T Y; T Z; };
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.