ASP error when uploaded ""An error occurred on the server when processing the URL"

Discussion in 'ASP General' started by Luke, Apr 7, 2004.

  1. Luke

    Luke Guest

    Hi

    I have the following code which is an ASP questionnaire using an Access
    database. (I am using access as I have no choice!). Basically there is an
    html form which submits the form to the page below and the code below
    submits the data to the DB and redirects the user.

    The code works locally on http://localhost or http://127.0.0.1 but when I
    upload it to a site (I have tried a few and they all error) it says "An
    error occurred on the server when processing the URL. Please contact the
    system administrator."

    I was thinking it may be as I am not putting the full path to the database
    i.e. c:/pathname/questionnaire.mdb but as I have to FTP it and I don't have
    access to the full path and cannot find out what it is.

    Has anyone any ideas on what this problem is or how to overcome it?
    Luke

    The code is:

    <% @LANGUAGE = VBScript %>
    <%
    Dim name, organisation, email, q1, q2
    Dim connString, objConn, sql_insert_det, sql_insert_res

    Set objConn = Server.CreateObject("ADODB.Connection")
    connString="DRIVER={Microsoft Access Driver (*.mdb)};" & _
    "DBQ=" & Server.MapPath("questionnaire.mdb") & ";"
    objConn.Open(connString)

    Function ChkString(string)
    If string = "" Then string = " "
    ChkString = Replace(string, "'", "''")
    End Function

    name = ChkString(Request.Form("name"))
    organisation = ChkString(Request.Form("organisation"))
    email = ChkString(Request.Form("email"))
    q1 = ChkString(Request.Form("Financial Institution Name"))
    q2 = ChkString(Request.Form("Do you use a branch"))

    sql_insert_det = "insert into userdetails (name, organisation, email) values
    ('" & name & "', '" & organisation & "', '" & email & "')"
    sql_insert_res = "insert into questionset1 (question1, question2) values ('"
    & q1 & "','" & q2 & "')"


    'execute the SQL
    objConn.execute(sql_insert_det)
    objConn.execute(sql_insert_res)

    If err.number=0 Then

    response.write "<span style='font-family:arial'>Thank you for completeing
    the questionnaire.</span>"
    Else
    response.write "There was a problem entering the data!"
    End If

    ' Done. Close the connection object
    objConn.Close
    Set objConn = Nothing

    %>
    Luke, Apr 7, 2004
    #1
    1. Advertising

  2. Luke

    Roland Hall Guest

    "Luke" wrote in message news:c50l7j$2nacvj$-berlin.de...
    : I have the following code which is an ASP questionnaire using an Access
    : database. (I am using access as I have no choice!). Basically there is an
    : html form which submits the form to the page below and the code below
    : submits the data to the DB and redirects the user.
    :
    : The code works locally on http://localhost or http://127.0.0.1 but when I
    : upload it to a site (I have tried a few and they all error) it says "An
    : error occurred on the server when processing the URL. Please contact the
    : system administrator."

    Did you?

    : I was thinking it may be as I am not putting the full path to the database
    : i.e. c:/pathname/questionnaire.mdb but as I have to FTP it and I don't
    have
    : access to the full path and cannot find out what it is.

    Response.Write(Request.ServerVariables("PATH_TRANSLATED"))

    This will give you the physical path to the script. You can figure it out
    from there.

    : connString="DRIVER={Microsoft Access Driver (*.mdb)};" & _
    : "DBQ=" & Server.MapPath("questionnaire.mdb") & ";"

    Server.MapPath only references the path under the web root. Your database
    should be located in an area not accessible virtually.

    \db
    \db\questionnaire.mdb
    \webroot
    \webroot\default.asp

    If your db is in the area similar to the above, using the PATH_TRANSLATED
    will give you the physical path. If it were:
    d:\inetpub\domainname\webroot then your physical path to your db would be:
    d:\inetpub\domainname\db

    HTH...

    --
    Roland Hall
    /* This information is distributed in the hope that it will be useful, but
    without any warranty; without even the implied warranty of merchantability
    or fitness for a particular purpose. */
    Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
    WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
    MSDN Library - http://msdn.microsoft.com/library/default.asp
    Roland Hall, Apr 7, 2004
    #2
    1. Advertising

  3. Luke

    Mark Schupp Guest

    You need to find out what the error message is. If you have access to the
    site then go into IIS admin, properties for the virtual directory, hit the
    configuration button on the virtual directory tab, on the application
    debugging tab set it to send detailed error messages.

    If you cannot do the above then add

    on error resume next

    to one of the problem pages and sprinkle

    if err.number <> 0 then
    response.write err.description
    response.end
    end if

    into your code until you find the line that is erroring.

    --
    Mark Schupp
    Head of Development
    Integrity eLearning
    www.ielearning.com


    "Luke" <> wrote in message
    news:c50l7j$2nacvj$-berlin.de...
    > Hi
    >
    > I have the following code which is an ASP questionnaire using an Access
    > database. (I am using access as I have no choice!). Basically there is an
    > html form which submits the form to the page below and the code below
    > submits the data to the DB and redirects the user.
    >
    > The code works locally on http://localhost or http://127.0.0.1 but when I
    > upload it to a site (I have tried a few and they all error) it says "An
    > error occurred on the server when processing the URL. Please contact the
    > system administrator."
    >
    > I was thinking it may be as I am not putting the full path to the database
    > i.e. c:/pathname/questionnaire.mdb but as I have to FTP it and I don't

    have
    > access to the full path and cannot find out what it is.
    >
    > Has anyone any ideas on what this problem is or how to overcome it?
    > Luke
    >
    > The code is:
    >
    > <% @LANGUAGE = VBScript %>
    > <%
    > Dim name, organisation, email, q1, q2
    > Dim connString, objConn, sql_insert_det, sql_insert_res
    >
    > Set objConn = Server.CreateObject("ADODB.Connection")
    > connString="DRIVER={Microsoft Access Driver (*.mdb)};" & _
    > "DBQ=" & Server.MapPath("questionnaire.mdb") & ";"
    > objConn.Open(connString)
    >
    > Function ChkString(string)
    > If string = "" Then string = " "
    > ChkString = Replace(string, "'", "''")
    > End Function
    >
    > name = ChkString(Request.Form("name"))
    > organisation = ChkString(Request.Form("organisation"))
    > email = ChkString(Request.Form("email"))
    > q1 = ChkString(Request.Form("Financial Institution Name"))
    > q2 = ChkString(Request.Form("Do you use a branch"))
    >
    > sql_insert_det = "insert into userdetails (name, organisation, email)

    values
    > ('" & name & "', '" & organisation & "', '" & email & "')"
    > sql_insert_res = "insert into questionset1 (question1, question2) values

    ('"
    > & q1 & "','" & q2 & "')"
    >
    >
    > 'execute the SQL
    > objConn.execute(sql_insert_det)
    > objConn.execute(sql_insert_res)
    >
    > If err.number=0 Then
    >
    > response.write "<span style='font-family:arial'>Thank you for completeing
    > the questionnaire.</span>"
    > Else
    > response.write "There was a problem entering the data!"
    > End If
    >
    > ' Done. Close the connection object
    > objConn.Close
    > Set objConn = Nothing
    >
    > %>
    >
    >
    >
    Mark Schupp, Apr 7, 2004
    #3
  4. Luke

    Luke Guest

    > to one of the problem pages and sprinkle
    >
    > if err.number <> 0 then
    > response.write err.description
    > response.end
    > end if
    >
    > into your code until you find the line that is erroring.




    Thanks for the reply I have done as you suggested and found out it is
    because there is not write access to the folder, so your debugging example
    really helped.

    I have therefore contacted my host in regard to this

    Luke
    Luke, Apr 8, 2004
    #4
    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. Matt G
    Replies:
    1
    Views:
    1,134
    Deepak Kumar Vasudevan
    Aug 22, 2003
  2. Luke
    Replies:
    2
    Views:
    21,904
  3. John Saunders
    Replies:
    0
    Views:
    1,234
    John Saunders
    Apr 7, 2004
  4. Replies:
    0
    Views:
    13,820
  5. kath
    Replies:
    2
    Views:
    476
Loading...

Share This Page