Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to use ASPError Object

Posted on 2004-11-26
33
Medium Priority
?
209 Views
Last Modified: 2008-02-01
Hi all,
I want to use ASPError Object in my asp page...

For that i opened IIS and go to the properties of my website. Then i press Custom Errors tab and edit the URL of 500;100 HTTP Error...
as /iisHelp/common/custom500.asp

where my custom500.asp includes--
<%
Dim objASPError
Set objASPError = Server.GetLastError()
Response.Write("ASPCode = " & objASPError.ASPCode)
Response.Write("ASPDescription = " & objASPError.ASPDescription)
Response.Write("Category = " & objASPError.Category)
Response.Write("Column = " & objASPError.Column)
Response.Write("Description = " & objASPError.Description)
Response.Write("File = " & objASPError.File)
Response.Write("Line = " & objASPError.Line)
Response.Write("Number = " & objASPError.Number)
Response.Write("Source = " & objASPError.Source)
objASPError.Clear
%>

now i create one asp page in my directory say error.asp which includes--
<%
dim strTest
strTest=1/0
%>

i just don't know how generate error on my Error.asp page......

i followed  the all the steps as mentioned in following URL
http://www.topxml.com/asp/asperror_object.asp

Pls help me out..

Regards,
Meenakshi Dhar
0
Comment
Question by:MeenakshiDhar
  • 17
  • 16
33 Comments
 
LVL 33

Expert Comment

by:sajuks
ID: 12680078
Did you change the custom500.asp file ?
The best way to do it is create the custom500.asp in you root directory ( inetpub\wwwroot \)
In the error mapping properties change it to /custom500.asp instead of /iisHELp/common/custom500.asp,

teh error taht you're getting is cos its not able to find the file.
have a look at http://support.microsoft.com/default.aspx?scid=kb;EN-US;q300043 .
0
 
LVL 33

Expert Comment

by:sajuks
ID: 12680095
the file location of custom500.asp if it is under the folder /iisHelp/common/ should be
 %SystemRoot%\WinNT\Help\IISHelp\Common\custom500.asp. I assume that you'vnt created this file yet.
0
 

Author Comment

by:MeenakshiDhar
ID: 12680192
ASP Error Object is introduced in ASP 3.0...how can i check the version of ASP...
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:MeenakshiDhar
ID: 12680202
i m using WIN 2000 with IIS 5.0
0
 

Author Comment

by:MeenakshiDhar
ID: 12680300
i have given this path
C:\WinNT\Help\IISHelp\Common\custom500.asp
but giving me an error  "not an absolute path"...

Regards,
Meenakshi Dhar
0
 
LVL 33

Expert Comment

by:sajuks
ID: 12680317
No no you are doing it wrong.
I gave you two alternatives.
1> with reference to this http://www.topxml.com/asp/asperror_object.asp
did you place custom500.asp  in this location  C:\WinNT\Help\IISHelp\Common\
without changing the url as indicated in the link.Dont change the link. Place the file that you've created inside this folder.

" i have given this path
C:\WinNT\Help\IISHelp\Common\custom500.asp
but giving me an error  "not an absolute path"..."
Dont change the path let it be as it is in the url taht you posted. Have you placed custom500.asp in this location
C:\WinNT\Help\IISHelp\Common\ ??
0
 
LVL 33

Expert Comment

by:sajuks
ID: 12680360
2> Change url to  /custom500.asp and save the  custom500.asp fiel in your wwwroot directory.
You shouldnot /cannot give the physical path like c:\innetpub\wwwroot it should always be the relative path
0
 

Author Comment

by:MeenakshiDhar
ID: 12680480
still not working...
what i did is...

my root folder is c:\Inetpub\wwwroot\Test
i changed URL to /custom500.asp and put custom500.asp file in 'Test'  folder...but not getting any error...showing me blank page...

Regards,
Meenakshi Dhar
0
 

Author Comment

by:MeenakshiDhar
ID: 12680514
i think the problem is with ASP version...not sure abt this...

Regards,
Meenakshi Dhar
0
 
LVL 33

Expert Comment

by:sajuks
ID: 12681818
If you use http://support.microsoft.com/default.aspx?scid=kb;EN-US;q300043
are you able to trap the errors ?
0
 

Author Comment

by:MeenakshiDhar
ID: 12702740
ya i m able to track errors using this...but if i want to know the line number at which error occurs then that thingcan be done only using ASPError Object...
0
 
LVL 33

Expert Comment

by:sajuks
ID: 12702837
Which IIS version are you usning ?
0
 

Author Comment

by:MeenakshiDhar
ID: 12702866
IIS 5.0
0
 

Author Comment

by:MeenakshiDhar
ID: 12702880
can u pls tell me how to chk the version of IIS...
0
 
LVL 33

Expert Comment

by:sajuks
ID: 12702896
Lets start from the beginning itself. We'll take http://www.topxml.com/asp/asperror_object.asp as reference
Follow the steps exactly as ishown in the example.Dont change a single thing.
Next save the  custom500.asp file to
 %SystemRoot%\WinNT\Help\IISHelp\Common\custom500.asp

Once thats done save the error page at the root istelf.
<%
           dim myvar
            myvar = 1/0    

%>
ie at c:\Inetpub\wwwroot\myerrorpage.asp
Do you get a blanl page or are you able to see the error.Restart iis before testing.
0
 

Author Comment

by:MeenakshiDhar
ID: 12702928
whenever i m saving my custom500.asp file at this location,

%SystemRoot%\WinNT\Help\IISHelp\Common\custom500.asp
i.e. C:\WinNT\Help\IISHelp\Common\custom500.asp

i m not able to save it as it gives an error message as --
"The path is not a local absolute URL Path.."



0
 
LVL 33

Expert Comment

by:sajuks
ID: 12702932
http://localhost/iisHelp/  should give you the version info.Check the info page.

Or you could
<%
Response.Write ScriptEngineMajorVersion & "." & ScriptEngineMinorVersion & "." & ScriptEngineBuildVersion
%>

or from explorer  right click on asp.dll and check the properties.

ASP 2 for windows NT
ASP 3 is only for Windows 2000
0
 
LVL 33

Expert Comment

by:sajuks
ID: 12702939
Are you saying you are not able to save in the url ?
The format is /IISHelp/Common\custom500.asp as shown in the page and not
C:\WinNT\Help\IISHelp\Common\custom500.asp
0
 

Author Comment

by:MeenakshiDhar
ID: 12702960
The vesrion is 5.6.7426..
and in URL i m entering "/IISHelp/Common\custom500.asp" only..
but still showing me blank page...
0
 
LVL 33

Expert Comment

by:sajuks
ID: 12702974
/IISHelp/Common/custom500.asp and not /IISHelp/Common\custom500.asp
0
 

Author Comment

by:MeenakshiDhar
ID: 12702982
ya i have done "IISHelp/Common/custom500.asp" ...
but still shows me blank page...
0
 
LVL 33

Expert Comment

by:sajuks
ID: 12703000
i hope you meant /IISHelp/Common/custom500.asp  and not IISHelp/Common/custom500.asp :-)
Try renaming custom500.asp to something else.
Where is your errorasp page locn ? Did you restart iis before checking. Clear temp internet files too for good measure.
0
 

Author Comment

by:MeenakshiDhar
ID: 12703018
yes i did everything...but no luck!!!!...my errorasp page is located at
C:/Intepub/wwwroot/errorpage.asp
0
 
LVL 33

Expert Comment

by:sajuks
ID: 12703048
Are you getting a blank page or a page not found error ?
Try adding some lines of code Response.Write "Hello" to check whether the page is the rite one thats getting loaded.
0
 

Author Comment

by:MeenakshiDhar
ID: 12703082
its not showing me any error...rest of the page is fine...if i added this code--Response.Write "Hello"..that it is displaying...
0
 
LVL 33

Expert Comment

by:sajuks
ID: 12703113
this is my errorhandle.asp page
<%@ Language=VBScript %>
<%

            dim myvar
            myvar = 1/0    

%>

this is my  custom500.asp
<%
            Dim objASPError
            Set objASPError = Server.GetLastError
            Response.Write("ASPCode = " & objASPError.ASPCode)
            Response.Write("ASPDescription = " & objASPError.ASPDescription)
            Response.Write("Category = " & objASPError.Category)
            Response.Write("Column = " & objASPError.Column)
            Response.Write("Description = " & objASPError.Description)
            Response.Write("File = " & objASPError.File)
            Response.Write("Line = " & objASPError.Line)
            Response.Write("Number = " & objASPError.Number)
            Response.Write("Source = " & objASPError.Source)

%>
both files are located at c:\inetpub\wwwroot.

For 500:100 i've the url as /custom500.asp

If i run the page i get an error
ASPCode = ASPDescription = Category = Microsoft VBScript runtime Column = -1Description = Division by zeroFile = /errorhandle.aspLine = 5Number = -2146828277Source =
0
 

Author Comment

by:MeenakshiDhar
ID: 12703120
i m using Visual Interdev 6.0...
it's not showing me  Server.GetLastError in dropdowm menu...
0
 
LVL 33

Expert Comment

by:sajuks
ID: 12703130
I've not worked with  Visual Interdev , i prefer editplus( or notepad ) for this. Just confirm that your errorhandle page
looks like this
<%@ Language=VBScript %>
<%

            dim myvar
            myvar = 1/0    

%>
and nothing else .
0
 

Author Comment

by:MeenakshiDhar
ID: 12703161
i have done the same thing which u mentioned above..but same blank page...i just don't know where exactly is the problem...i m using windows 2000 professional...
0
 
LVL 33

Accepted Solution

by:
sajuks earned 200 total points
ID: 12703174
Server needs to be  Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0.
Since you've 2000 proffsnl its a no go. Check in m/c where you've either Windows Server 2003, Windows 2000 Server, or Windows NT Server 4.0.
The client machine can be Windows XP Professional, Windows 2000 Professional, or Windows NT Workstation 4.0.
Thats y you are not seeing the error
0
 

Author Comment

by:MeenakshiDhar
ID: 12703199
ok...thx a lot sanjuks for ur help...i need to chk this one now...
0
 
LVL 33

Expert Comment

by:sajuks
ID: 12703211
Thanks for the points and grade.
Shoud've asked for your OS initially itself,my bad.Could've avoided so many posts :-)
and its sajuks and not sanjuks  ;-)
0
 

Author Comment

by:MeenakshiDhar
ID: 12703269
ok sajuks...
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses
Course of the Month21 days, 6 hours left to enroll

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question