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

Discussion in 'ASP General' started by mallyonline, Oct 7, 2005.

  1. mallyonline

    mallyonline Guest

    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
     
    mallyonline, Oct 7, 2005
    #1
    1. Advertising

  2. mallyonline

    Tim Slattery Guest

    "mallyonline" <> 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)
     
    Tim Slattery, Oct 7, 2005
    #2
    1. Advertising

  3. mallyonline

    Steven Burn Guest

    <%
    '// #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" <> wrote in message
    news:di6juh$j0u$-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
    >
    >
     
    Steven Burn, Oct 7, 2005
    #3
  4. mallyonline

    McKirahan Guest

    "mallyonline" <> wrote in message
    news:di6juh$j0u$-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!
     
    McKirahan, Oct 7, 2005
    #4
  5. 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"
     
    Bob Barrows [MVP], Oct 8, 2005
    #5
  6. mallyonline

    McKirahan Guest

    "Bob Barrows [MVP]" <> wrote in message
    news:...
    > McKirahan wrote:
    > >
    > > http://www.aspfaq.com/5003 again!

    >
    > Where else was this posted?


    microsoft.public.inetserver.asp.components
     
    McKirahan, Oct 8, 2005
    #6
  7. 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 ***
     
    malcolm whyte, Oct 8, 2005
    #7
  8. mallyonline

    Steven Burn Guest

    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" <> wrote in message
    news:#sTz5F$...
    >
    > 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 ***
     
    Steven Burn, Oct 8, 2005
    #8
  9. mallyonline

    mallyonline Guest

    I have now read and fully understand what you are saying.

    Kind Regards
    Malcolm


    "McKirahan" <> wrote in message
    news:...
    > "Bob Barrows [MVP]" <> wrote in message
    > news:...
    >> McKirahan wrote:
    >> >
    >> > http://www.aspfaq.com/5003 again!

    >>
    >> Where else was this posted?

    >
    > microsoft.public.inetserver.asp.components
    >
    >
     
    mallyonline, Oct 9, 2005
    #9
  10. mallyonline

    mallyonline Guest

    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.FileSystemObject")
    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" <> wrote in message
    news:%23DUdK5$...
    > 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" <> wrote in message
    > news:#sTz5F$...
    >>
    >> 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 ***

    >
    >
     
    mallyonline, Oct 9, 2005
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Charles A. Lackman
    Replies:
    2
    Views:
    8,044
    Charles A. Lackman
    Jan 11, 2006
  2. Matthew Wieder

    Response.Write and Response.Redirect

    Matthew Wieder, Jul 17, 2003, in forum: ASP .Net
    Replies:
    4
    Views:
    729
    Kevin Spencer
    Jul 17, 2003
  3. keithb
    Replies:
    0
    Views:
    644
    keithb
    Feb 16, 2006
  4. gk

    you are not logged in

    gk, Feb 12, 2006, in forum: Java
    Replies:
    6
    Views:
    1,326
  5. Replies:
    1
    Views:
    964
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Apr 12, 2007
Loading...

Share This Page