Results 1 to 4 of 4
  1. #1
    cgschlangen
    Guest

    ASP Scripting Problem

    Howdy all... This is an include I'm working on for my Site - and I'm having some problems implementing it... When I pull up the page the file is included in I get a simple error stating "There has been an error." Can anyone catch what I've done wrong?
    Thanks in advance
    Dan

    <font color=008080><%
    Response.Buffer = True
    pCount = Request.Form(&quot;dologin&quot.Count

    '=========================================
    'Check to see if user is logged in already
    '=========================================
    If Session(&quot;logonid&quot.Count > 0 Then
    Validate = True
    End If
    '=============================================
    'Upon completion of form - process this script
    '=============================================
    If (pCount = 1) Then
    username = Request.Form(&quot;id&quot
    strPass = Request.Form(&quot;pwd&quot
    set conn = Server.CreateObject(&quot;ADODB.Connection&quot
    conn.Provider = &quot;Microsoft.Jet.OLEDB.4.0&quot;
    conn.Open(Server.Mappath(&quot;cgms.mdb&quot)
    set rs = Server.CreateObject(&quot;ADODB.Recordset&quot
    sql = &quot;SELECT * FROM Users WHERE username=&quot; & chr(34) & username & chr(34)
    rs.Open sql,conn,3,3
    sPWD = rs(&quot;password&quot
    sEmail = rs(&quot;email&quot

    If strPass = sPWD Then
    Validate = True
    Session(&quot;logonid&quot = username
    Session(&quot;email&quot = sEmail
    Else
    Validate = False
    End If

    End If
    '================================================= =============
    'If the user entered the wrong password then send them to index
    '================================================= =============
    If Validate = False Then
    Response.Redirect sIncURL
    End If

    '================================================= =========
    'Find out what the script variables are for form processing
    '================================================= =========
    Dim sIncURL
    sIncURL = Request.ServerVariables(&quot;SCRIPT_NAME&quot
    If Request.ServerVariables(&quot;QUERY_STRING&quot <> &quot;&quot; Then

    sIncURL = sIncURL & &quot;?&quot; & Request.ServerVariables(&quot;QUERY_STRING&quot
    End If
    '================================================= ==========
    'If User is not logged in, and hasnt filled out form do this
    '================================================= ==========
    If (pCount < 1) Then
    %>
    There's a simple html form that goes here - but I'm not sure how to make The forum display the html code [img]/forums/images/smilies/tongue.gif[/img]~
    <%
    Response.End
    End If
    %></font color=008080>

  2. #2
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ASP Scripting Problem

    Dan,

    Just curious - are the " items showing instead of quotes due to the Lounge's display? Or are you actually using that in your ASP code?

    If the latter is the case, you'll probably want to use an actual double-quote character in your server-side code.

    Other than that, nothing catches my eye. I would double-check your connection strings and SQL strings to make sure those work fine.

    Also, if you're getting a generic error, check your IE settings to make sure "Show Friendly HTTP Error messages" is NOT checked (Tools | Options > Advanced)

    Hope this helps!

  3. #3
    cgschlangen
    Guest

    Re: ASP Scripting Problem

    Hrmmm - the forum doesn't like my Notepad pastes at all... I've attached a copy of the file for "perusal"
    I've double and triplle checked all the connection strings... and I'm still getting a "friendly error" even though I have that option turned off... (*sigh*)
    I'm sure there's another way of doing this - but I'm one of those guys who likes to find out why things went wrong when the do go wrong...
    Thanks for your help
    Dan
    Attached Files Attached Files

  4. #4
    Silver Lounger
    Join Date
    Jan 2001
    Location
    Indianapolis, Indiana, USA
    Posts
    1,862
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ASP Scripting Problem

    Ahh - seeing the source formatting helps! (Keep in mind that I haven't written classic ASP for well over a year - I switched to ASP.NET.)

    Here are a couple of possible issues.
    1) I don't remember if this is an issue in Classic ASP or not, but ASP.NET gets fussy when you check the value of a variable that does not exist. For instance, your line If Session("logonid").Count > 0 Then could possibly be a problem if the Session("logonid") does not exist (at least in .NET). But if that usually works in classic ASP then it's not the problem here. (In ASP.NET, I would have to check to see if Session("logonid") Is Nothing (or null, for C#), then check its value if it actually exists.)

    2) You're using the code as an include file, right? If so, the included header.asp and footer.asp files could be causing the problem. I'm rather sure you can not nest Include files. I tried once and discovered the hard way that it does not work. A workaround could be to use the TextStream (part of FileSystem Object) to open and read the contents of the respective ASP files into the desired positions.

    Hope this helps! <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •