1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to make a default page for "Website is down for maintenance"?

Discussion in 'Site & Server Administration' started by mike2016, Jan 21, 2010.

  1. #1
    We need to take the database server down for an hour or two once in a while, our visitors have been getting the white background internal server error message when the db server is down.
    SEMrush
    Is there a way to make a more friendly looking page? instead of the generic looking default page from IIS? At least put our logo on it and tell visitors the site will be back shortly...

    We don't take the web server down at all, only the db server requires periodic maintenance every once in a while.

    This is for IIS 6.0 / WIn2003.

    Thanks!
     
    mike2016, Jan 21, 2010 IP
    SEMrush
  2. Rudolf Bodocsi

    Rudolf Bodocsi Peon

    Messages:
    69
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    hi,

    I will be check database query error message after every transaction, and if you have one than its will be show my out of service web page.

    Rudolf
     
    Rudolf Bodocsi, Jan 22, 2010 IP
  3. Warll

    Warll Peon

    Messages:
    122
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Use the ISS equivalent to htaccess and redirect all traffic to a static html file.
     
    Warll, Jan 29, 2010 IP
  4. jonmaster

    jonmaster Peon

    Messages:
    181
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Depends on the what code you use asp or asp.net

    IN CASE OF CLASSIC ASP

    you can use

    ON ERROR RESUME NEXT

    IN CASE OF ASP.NET

    TRY CATCH FINALLY

    whenever you catch an database connection error, you can redirect to an customer error page like maintenance.html

    This will look fine when there is a real database error, or deliberate database maintenance.


    OR you could add a single line of redirect code on top of all the pages during the maintenance.

    tell me the scripting technology, i will paste the code
     
    jonmaster, Feb 2, 2010 IP
  5. mike2016

    mike2016 Peon

    Messages:
    29
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    It's in classic ASP vbscript. should this code placed in every .asp page?
     
    mike2016, Feb 2, 2010 IP
  6. jonmaster

    jonmaster Peon

    Messages:
    181
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #6
    How is your connection string is placed, it is in all pages seperately.

    Or did u create a single asp file that has the connection string and named as connection.asp or(myconnection.asp)

    then added this file in all asp pages as SERVER SIDE INCLUDE(THIS IS WHAT WE ALL DO), if this is the case it is easy to maintain.

    No matter i will paste the snippet

    
    'response.Redirect("maintenance.asp")
    
    
    server.ScriptTimeout=180
    dim objconn, straddress, strconnect
    straddress = server.MapPath("db\MYDATABASE.mdb") ' Finding the root path of the database
    
    strconnect = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source = " & straddress & ";" &" Persist Security Info=False" ' connection string required to open database for OLEDB DRIVER
    
    set objconn=server.CreateObject("adodb.connection") ' Creating an ADODB CONNECTION OBJECT
    
    On Error resume Next
    
    
    objConn.open strconnect ' Opening the adodb object
    If Err.Number <> 0 then
     response.Redirect("maintenance.asp")
    Error.Clear
    End If
    
    
    Code (markup):
    the above is an example for access database, in case of deliberate maintenance you can remove the single quote in the first line.
     
    jonmaster, Feb 2, 2010 IP