Handling HTTP 500 - Internal server errors


I have a dynamic asp page that takes input from a url. IE: parts.aspsku=543
From there it looks up the sku in a database and outputs the part information.

Currently if you put in an invalid sku that is not in my database, you just get a Internal server error.

Whats the correct way to give a 404 Do I just do a Response.Redirect to my 404.asp page if the recordset is empty
Posted On: Friday 26th of October 2012 07:36:25 AM Total Views:  445
View Complete with Replies

RELATED TOPICS OF ASP PROGRAMMING LANGUAGE




Error Propagation on page and its handling

I want to capture err.description into asp variable when any error occurs in the pages as a whole. Suppose some error occurs at the top of the page say ADO Block. Can it will travel till page end, or can every error necessarily stop the proceedings and throw error resulting page crash. My ultimate aim is to capture error in asp variable when ever crashable error occurs. How to capture it. I am writing rough sketch please correct it. [ADO Block Code] Code: 'last block
VIEWS ON THIS POST

128

Posted on:

Wednesday 10th October 2012
View Replies!

[HELP!!!] erorr handling and Rss feeds!!

hello, recently i became stumped as to the use of the "on error resume next" property of asp (by the way, is it even a property if not, what is it technically\t object class event function etc\t) FIRST --- what i was running into were script timeouts... resume next REFUSES to do its job when the script times out. is there any way to handle a script timeout error and then to create an error handling function or is it what i think it is: once the script times out, thats all folks and no, increasing the script timeout time is NOT applicable to what im doing here! press right on if thats your suggestion!!!!! SECONDLY -- i dont know JACK about RSS feeds.. all i know is that a person can create a blog entry on their site, and someone else can receive the feed and then do something with it. my question here is three parts: 1) if i have a page, how would i dynamically call for that RsS feed to incorporate it on my page a chron job of some sort 2) if i want to blog someone elses RSS feed, how would i go about doing that that is, what is the theory behind doing it where my blog is concerned 3) i downloaded this blog (http://www.uapplication.com/ublog/index.asp) since it was simple to install, used an access database, and was of course in ASP. if anyone is familiar with it, can i use someone elses RSS feed to populate this blog app OR--- is there another blog i can use that is free/uses asp/uses ms access that can import an RSS feed HELP PLEASE!!
VIEWS ON THIS POST

128

Posted on:

Wednesday 10th October 2012
View Replies!

how use the array handling

how use the array handling in asp pls snd any sample code
VIEWS ON THIS POST

134

Posted on:

Wednesday 10th October 2012
View Replies!

Help with handling copy and pasted data

Hi I have a form for visitors to enter details. It all works but for one flaw, which arises sometimes when they copy and paste content from their own web page. And I can't figure out how to handle it, can't determine what to strip out. As an example, the html they are actually copying is: Hot water for tea, cocoa, apple cider, and coffee.   Popcorn and ice also available. What they highlight and copy in their browser is: 'Hot water for tea, cocoa, apple cider, and coffee. ' 'Popcorn and ice also available. ' NB. I have added the single quotes to highlight the spaces at the end that seem to be the problem, or the new line break maybe The page is falling over trying to enter this text, getting error 507 message. It gets the same problem just adding the pasted '. ' 'P' (I've added the single quotes to highlight the spaces.) Now I've tried handling this with: fulltext = Trim(Request("fulltext")) fulltext = Replace(fulltext," "," ") fulltext = Replace(fulltext,Chr(13),"") fulltext = Replace(fulltext,Chr(10),vbcrlf) fulltext = Replace(fulltext," "," ") fulltext = Replace(fulltext," " & vbcrlf,vbcrlf) fulltext = Replace(fulltext," " & vbcrlf,vbcrlf) fulltext = Replace(fulltext," " & vbcrlf,vbcrlf) fulltext = Replace(fulltext," "," ") fulltext = Replace(fulltext," "," ") [Added ... hah the ASP forum is stripping the example three spaces down to one! .. there's 3 spaces showing in the form after coffee.] But this isn't fixing it. Can anyone offer any suggestions\t I'm pulling my hair out! Johnie
VIEWS ON THIS POST

156

Posted on:

Wednesday 10th October 2012
View Replies!

Error handling "ADODB.Stream error '800a0bba' File could not be opened"

I am getting this error ocassionally "ADODB.Stream error '800a0bba' File could not be opened" at Function LoadStream at line objStream.LoadFromFile FilePath . Please advise me on this. When i am trying to open images. My Code: = 1 then equal= equal Else equal= strCheckslash & equal End if FilePath = equal SendStreamToBrowser LoadStream(FilePath),FilePath,"pdf",true ' Else ' Response.write("Access Denied") 'Response.write(equal) + Response.write(equal) 'End if End if Function LoadStream(FilePath) Dim objStream Set objStream = Server.CreateObject("ADODB.Stream") objStream.Type = 1 'adTypeBinary=1 objStream.Open objStream.LoadFromFile FilePath -- error at this line LoadStream = objStream.Read objStream.Close Set objStream = Nothing End Function 'returns the MIME header type for a given extension Function GetMIMEType(Extension) dim Ext Ext = UCase(Extension) select case Ext 'Common documents case "TXT", "TEXT", "JS", "VBS", "ASP", "CGI", "PL", "NFO", "ME", "DTD" sMIME = "text/plain" case "HTM", "HTML", "HTA", "HTX", "MHT" sMIME = "text/html" case "CSV" sMIME = "text/comma-separated-values" case "JS" sMIME = "text/javascript" case "CSS" sMIME = "text/css" case "PDF" sMIME = "application/pdf" case "RTF" sMIME = "application/rtf" case "XML", "XSL", "XSLT" sMIME = "text/xml" case "WPD" sMIME = "application/wordperfect" case "WRI" sMIME = "application/mswrite" case "XLS", "XLS3", "XLS4", "XLS5", "XLW" sMIME = "application/msexcel" case "DOC" sMIME = "application/msword" case "PPT","PPS" sMIME = "application/mspowerpoint" 'WAP/WML files case "WML" sMIME = "text/vnd.wap.wml" case "WMLS" sMIME = "text/vnd.wap.wmlscript" case "WBMP" sMIME = "image/vnd.wap.wbmp" case "WMLC" sMIME = "application/vnd.wap.wmlc" case "WMLSC" sMIME = "application/vnd.wap.wmlscriptc" 'Images case "GIF" sMIME = "image/gif" case "JPG", "JPE", "JPEG" sMIME = "image/jpeg" case "PNG" sMIME = "image/png" case "BMP" sMIME = "image/bmp" case "TIF","TIFF" sMIME = "image/tiff" case "AI","EPS","PS" sMIME = "application/postscript" 'Sound files case "AU","SND" sMIME = "audio/basic" case "WAV" sMIME = "audio/wav" case "RA","RM","RAM" sMIME = "audio/x-pn-realaudio" case "MID","MIDI" sMIME = "audio/x-midi" case "MP3" sMIME = "audio/mp3" case "M3U" sMIME = "audio/m3u" 'Video/Multimedia files case "ASF" sMIME = "video/x-ms-asf" case "AVI" sMIME = "video/avi" case "MPG","MPEG" sMIME = "video/mpeg" case "QT","MOV","QTVR" sMIME = "video/quicktime" case "SWA" sMIME = "application/x-director" case "SWF" sMIME = "application/x-shockwave-flash" 'Compressed/archives case "ZIP" sMIME = "application/x-zip-compressed" case "GZ" sMIME = "application/x-gzip" case "RAR" sMIME = "application/x-rar-compressed" 'Miscellaneous case "COM","EXE","DLL","OCX" sMIME = "application/octet-stream" 'Unknown (send as binary stream) case else sMIME = "application/octet-stream" end select GetMimeType = sMIME End Function 'Sends the specified file to the browser sub SendStreamToBrowser(FileStream, FileName, ContentType, IsInline) Dim FileExt, FileSize 'Disable error checking on error resume next 'Clear buffer Response.Clear FileExt = mid(FileExt, instrrev(FileName,".") + 1) FileSize = Ubound(FileStream) + 1 'Add filename to header Response.AddHeader "Connection", "keep-alive" Response.AddHeader "Content-Length", FileSize 'Check if data should be delivered inline or not If IsInline = True then 'ow the browser to render the file inside a browser window (if it can) Response.AddHeader "Content-Disposition","inline; filename=" & FileName Else 'Force browser to save file Response.AddHeader "Content-Disposition","attachment; filename=""" & FileName & """" End If 'Get ContentType for download select case ContentType case false 'Generic binary ContentType and Charset Response.ContentType = "application/octet-stream" Response.Charset = "UTF-8" case "" 'Find out what it should be Response.ContentType = GetMIMEType(FileExt) case else 'Use the ContentType that was passed Response.ContentType = ContentType end select 'Send data to client Response.BinaryWrite(FileStream) Response.Flush End Sub %>
VIEWS ON THIS POST

222

Posted on:

Thursday 11th October 2012
View Replies!

Error handling

I have a script that takes gathered customer data, sends it to the gateway (ecommerce site), then takes the response from the gateway and redirects or prints out any errors (invalid CC number, declined etc.). Well, if you haven't heard, Authorize.net has been getting hammered by DDoS attacts recently so the script fails when trying to connect to them. Hence, I lose a sale... in most cases. What I want to do is redirect the customer to another page if I CAN"T make the connection instead of them getting some stupid error. Any code snippits to check for the lack of connection would be welcomed. Code: 'Send the transaction info as part of the querystring to Certification Server set xml = Server.CreateObject("Microsoft.XMLHTTP") xml.open "POST", "https://secure.gateway/url" _ & PostData & "", false '===the line below sends all of the data but if the gateway is '===down then the customer gets an ugly error xml.send "" strStatus = xml.Status strRetval = xml.responseText set xml = nothing
VIEWS ON THIS POST

149

Posted on:

Thursday 11th October 2012
View Replies!

Error handling inside classes

I can't seem to get error handling to work from inside my classes. On the outside it works but on the inside it doesn't. Any thoughts Code: if err.number 0 then response.write "errors" end if I'm trying to catch all the errors as I go and I can't do that if it won't work on the inside of my classes.
VIEWS ON THIS POST

131

Posted on:

Thursday 11th October 2012
View Replies!

Event handling in asp?? Urgent pls help

I have an asp page with drop down listbox. I have captured oncellchange event of that box. But while debugging, I put a break point on that function, it gives error "Not an executable code". Even when i put alert to display message box. Nothing is displayed. Moreover when i make the same asp page to html and capture the event, it works. I'm using Java scripts on client side and vbscript on server side. Can anybody pls. tell me why can't asp page handle the events\t
VIEWS ON THIS POST

197

Posted on:

Thursday 11th October 2012
View Replies!

ASP 1.0 (I know it's old!) File handling

Originally posted by : stevedid you check out http://support.microsoft.com or http://www.microsoft.com/technet/Search for this info. Or another good place is charles carroll asplistshttp://www.asplists.comthat is where i'd start looking! Good luck and I feel for you!steve------------John Marsh at 3/16/2000 10:35:11 AMI had a shock when I was asked to write a simple routine for a client that just wrote a log entry. I used filesystemobject etc but I found out that the old IIS 3.0 and ASP 1.0 were installed with no chance of an upgrade. Does anyone know how to do the following without using fso1. Check to see if a folder exists2. Check to see if a file exists
VIEWS ON THIS POST

158

Posted on:

Thursday 11th October 2012
View Replies!

objMail.Send error handling

I was just wondering how I could handle errors from the email sending function. I ahave found that if the user fills in an email incorrectly which doesn't exist, an error is displayed and the email is not sent. I would like to stop the error appearing and instead, if an error occurs, change the objMail.To to a preset email and send their instead.
VIEWS ON THIS POST

185

Posted on:

Thursday 11th October 2012
View Replies!

Asp String handling function for VBScript, SQL, Javascript

Let me explain what I'm trying to do. I get user input from forms and store it in a database. I get data from the database and put it back into forms for editing and also into tables for display. I put data from the database into javascript to dynamically create select lists that are then used to populate forms. I'm trying to find a way to take user input, store it exactly(minus special markup) in the database as they type it. But also be able to bring that data back out and not have it screw up my javascript and html by having carriage returns, line feeds, single and double quotes in it. If someone types html into a textarea, I want to store it in the database as html, bring it back to the screen in a report that shows the html, not formats based on the html. If someone puts in double quotes and single quotes(apostrophes), I don't want it to error in the database, end an html attribute value prematurely, or cause an unterminated string constant error in javascript. My first try is below. Your opinions please, and if you have a simpler, more efficient way, please point me in that direction. Code:
VIEWS ON THIS POST

128

Posted on:

Friday 12th October 2012
View Replies!

error handling and include files

I have two asp files (file1 and file2). "File1" is used as an include on "File2."\t"File2" is also dependent on successful processing of "File1."\tWhat happens if "File1" generates an error\tI have an error handler in "File2" and am curious as to whether it would catch the error.\tWhat is the best way to go about error handling in this scenario\tShould I create another asp file with an error handler and use that as an include file in "file 1" and "file 2"\tAny insight would be greatly appreciated.
VIEWS ON THIS POST

169

Posted on:

Tuesday 16th October 2012
View Replies!

Email handling

I have email to freind option in my web site. I am using internal SMTP address using SQL Server to send emails. But this way anyone can write a loop & sends email using my smtp to send emails.Is there a ways we can identify that this request for email came through using my website form
VIEWS ON THIS POST

152

Posted on:

Tuesday 16th October 2012
View Replies!

Error handling in ASP

I've got a class in ASP and instantiate an object with it.\tWithin the class is no error handling as yet.\tI understand that VBScript error handling is similar to that in VB - I have tried using the same sort of error handling but am getting a syntax error.\tAny help would be gratefully appreciated.\tThe code is;Public Function GetURL(ByRef pStrURL)\t\t\t\t'Variables\t\t\t\tDim lObjSpider\t\t\t\tDim strText\t\t\t\t\t\t\t\t'Return if no URL has been passed\t\t\t\tIf pStrURL = "" Then Exit Function\t\t\t\t'On Error Resume Next\t\t\t\t\t\t\t\t'Create spider object\t\t\t\tSet lObjSpider = Server.CreateObject ("Microsoft.XMLHTTP")\t\t\t\t\t\t\t\t' Could not create Internet Control\t\t\t\tIf Err Then\t\t\t\t\t\tGetURL = "Error: " & Err.Description\t\t\t\t\t\tExit Function\t\t\t\tEnd If\t\t\t\t\t\t\t\t'On Error Goto 0\t\t\t\tOn Error Goto Error_Handler\t\t\t\t\t\t\t\tWith lObjSpider\t\t\t\t\t\t.Open "GET", pStrURL, False, "", ""\t\t\t\t\t\t.Send\t\t\t\t\t\tGetURL = .ResponseText\t\t\t\tEnd With\t\t\t\tSet LobjSpider = Nothing\t\t\t\t'strHTML = GetURL\t\t\t\tRetrievedstrHTML = "Andy tester text"\t\t\t\t\t\t\t\t'Return\t\t\t\tExit Function\t\t\t\t\t\t\t\t'Error handling\t\t\t\tError_Handler:\t\t\t\tGetURL=""\t\tEnd Function
VIEWS ON THIS POST

133

Posted on:

Tuesday 16th October 2012
View Replies!

How to write error handling code?

:\t\tI have finished writing my ASP coding. In my program I used connection, recordset to access backend database, used CDONTS to send email. There is no error handling in my coding. Anybody can show me how to do itHaijun
VIEWS ON THIS POST

207

Posted on:

Tuesday 16th October 2012
View Replies!

string handling?

I have a select control that contains just a few codes:A1B2#!When a user selects a code i trigger a query run against a db table(Oracle) for the description of that code using the code as a match criteria. For example if i choose "A1" i get "description X" to populate an adjacent text area control and so forth. Everything works except when the user selects "#".When the user selects "#" the query returns nothing - although I can see that the right parameter is being passed in my querystring at the address bar of the browser window.It's strange because I am using "server.HTMLEncode(request.QueryString("Var1"))" but it's not working..Does anyone know whats wrong and/or what i need to do to fix it
VIEWS ON THIS POST

143

Posted on:

Wednesday 17th October 2012
View Replies!

Document handling in ASP?

I'm going to make an intranet for the company I work for. But I don't want to be the guy who updates the info/data dokuments after the site is done. So what I want to know is methods to make it as easy as possible. Most of the ppl here at work don't know any HTML etc, and I don't want to make hundreds of forms for every page for them to post into an database.So any suggestions applications solutions what is normal
VIEWS ON THIS POST

148

Posted on:

Thursday 18th October 2012
View Replies!

handling images

I see a lot of posts here and on the SQL Server site talking about having images stored in your file system rather than in your database.I have not had to handle images yet (mostly because I am putting them off until last).\tBut my application will involve users submitting images.I would like to know why seems so adverse to storing the images within the database.\tIn SQL Server 7.0 I believe there are a couple of datatypes designed to store things like images.\tSo I am unsure of what the problems are with storing the images directly in the database.If anyone can shed some light on this issue for me, or point me in the direction of some good articles I would appreciate it. Crystalcrystals@genesis.sk.ca-------------------------------------------------- Experience is one thing you can't get for nothing. -Oscar Wilde
VIEWS ON THIS POST

189

Posted on:

Thursday 18th October 2012
View Replies!

ASP Server status sniffing ? error handling offline server

I have an asp page that calls a page on a different server (server 2). I want to be able to write some error handling script that identifies if server 2 is down and if so displays some helpful text telling the user they cannot use the Application, this is as opposed to the browser bringing up a 401 or 403 error.Is it possible to get these error codes via asp and therfore write some handling code any ideas
VIEWS ON THIS POST

239

Posted on:

Sunday 21st October 2012
View Replies!

Problem handling form variables

I need to use string functions on a form variable: Something like this: Code: But I keep getting the error: Object doesn't support method or Invalid argument for function Left (something like these) Please help kay
VIEWS ON THIS POST

150

Posted on:

Friday 26th October 2012
View Replies!