p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

asp_components thread: How can i debug VB Components?


Message #1 by "Nguyen Anh Tuan" <tuancan@y...> on Wed, 22 May 2002 09:59:50
How can i debug VB Components? 

This is my process: 

+ Compile my component 
+ Register it in MTS 
+ Write an ASP page to create an instance of my object, then set that page 
in Project/Debugging option in VB 
+ Press Ctrl + F5 for Full Compile 

ASP Code: 

<%@ Language=VBScript %> 
<html> 
<head> 
</head> 
<body> 

<% 
    Set myGrid = Server.CreateObject("myGrid.TextOnly") ' Line 8 
     
    Call myGrid.Generate() 
%> 

</body> 
</html> 

====================================

But browser show that error: 

Server object error 'ASP 0178 : 80070005' 

Server.CreateObject Access Error 

/myGrid/TestCOM.asp, line 8 

The call to Server.CreateObject failed while checking permissions. Access 
is denied to this object. 

====================================

Can you tell me step by step of this debugging process? Thanks a lot!
Message #2 by "Adrian Forbes" <adrian.forbes@n...> on Wed, 22 May 2002 16:12:07
Make sure your IIS is set to "Integrated Windows Authentication" *only*, 
ie remove Anon Access if you have it.

> How can i debug VB Components? 

> This is my process: 

> + Compile my component 
+>  Register it in MTS 
+>  Write an ASP page to create an instance of my object, then set that 
page 
i> n Project/Debugging option in VB 
+>  Press Ctrl + F5 for Full Compile 

> ASP Code: 

> <%@ Language=VBScript %> 
<> html> 
<> head> 
<> /head> 
<> body> 

> <% 
 >    Set myGrid = Server.CreateObject("myGrid.TextOnly") ' Line 8 
 >     
 >    Call myGrid.Generate() 
%> > 

> </body> 
<> /html> 

> ====================================

> But browser show that error: 

> Server object error 'ASP 0178 : 80070005' 

> Server.CreateObject Access Error 

> /myGrid/TestCOM.asp, line 8 

> The call to Server.CreateObject failed while checking permissions. 
Access 
i> s denied to this object. 

> ====================================

> Can you tell me step by step of this debugging process? Thanks a lot!
Message #3 by "Nguyen Anh Tuan" <tuancan@y...> on Wed, 22 May 2002 17:55:17
How can i set that setting? Thanks!
Message #4 by "Johnson, Israel" <IJohnson@R...> on Wed, 22 May 2002 12:59:41 -0400
The components will have to be debugged by creating a VB project or project
Group and using debug.print to test. Or try using Visual Interdev
Debugger....   

-----Original Message-----
From: Nguyen Anh Tuan [mailto:tuancan@y...]
Sent: Wednesday, May 22, 2002 1:55 PM
To: ASP components
Subject: [asp_components] Re: How can i debug VB Components?


How can i set that setting? Thanks!
 
%%email.unsub%%

Message #5 by "Nguyen Anh Tuan" <tuancan@y...> on Wed, 22 May 2002 18:13:38
Thanks, but i can not create an instance of Request object from 
ObjectContext object. Why?

Code:

Private objContext As COMSVCSLib.ObjectContext

Private objRequest As ASPTypeLibrary.Request
Private objResponse As ASPTypeLibrary.Response

Private Sub Class_Initialize()
    Set objContext = GetObjectContext()

    Set objRequest = objContext("Request") 	<-- It shows "Run-time 
error '424' Object required" error at this line
    Set objResponse = objContext("Response")
End Sub
Message #6 by "Rakesh" <barjatiyarakesh@h...> on Thu, 23 May 2002 22:56:13 -0700
to making asp component you have to include asp.dll in your project.And
folowing code in your class
to include asp.dll into project  in vb project>>preferences>>Microsoft
Active Server Pages.
################## Code ###########333

   Private MyScriptingContext As ScriptingContext
   Private MyApplication As Application
   Private MyRequest As Request
   Private MyResponse As Response
   Private MyServer As Server
   Private MySession As Session
   Private rs As Recordset

Public Sub OnStartPage(PassedScriptingContext As ScriptingContext)
    Set MyScriptingContext = PassedScriptingContext
    Set MyApplication = MyScriptingContext.Application
    Set MyRequest = MyScriptingContext.Request
    Set MyResponse = MyScriptingContext.Response
    Set MyServer = MyScriptingContext.Server
    Set MySession = MyScriptingContext.Session
End Sub


Public Sub OnEndPage()           ' -------This Procedure is optional it is
just example
    Set MyScriptingContext = Nothing
    Set MyApplication = Nothing
    Set MyRequest = Nothing
    Set MyResponse = Nothing
    Set MyServer = Nothing
    Set MySession = Nothing
    Set rs = Nothing
    Set Conn = Nothing
End Sub

Public Sub test1()
    '----- Declare the variables used in this Sub
    Dim strVariable As String
    Dim intCount As String
    '----- Get the Query String, if any, and increase it by one
    intCount = MyRequest.Form("UserName")
    '----- Constuct the HTML code to send back to the browser
    strVariable = "Your UserName is :-<b>"
    strVariable = strVariable & intCount & "</b>"
    '----- Send the constructed HTML code
    MyResponse.Write (strVariable)
End Sub



################3333333


Rakesh

----- Original Message -----
From: "Nguyen Anh Tuan" <tuancan@y...>
To: "ASP components" <asp_components@p...>
Sent: Wednesday, May 22, 2002 9:59 AM
Subject: [asp_components] How can i debug VB Components?


> How can i debug VB Components?
>
> This is my process:
>
> + Compile my component
> + Register it in MTS
> + Write an ASP page to create an instance of my object, then set that page
> in Project/Debugging option in VB
> + Press Ctrl + F5 for Full Compile
>
> ASP Code:
>
> <%@ Language=VBScript %>
> <html>
> <head>
> </head>
> <body>
>
> <%
>     Set myGrid = Server.CreateObject("myGrid.TextOnly") ' Line 8
>
>     Call myGrid.Generate()
> %>
>
> </body>
> </html>
>
> ====================================
>
> But browser show that error:
>
> Server object error 'ASP 0178 : 80070005'
>
> Server.CreateObject Access Error
>
> /myGrid/TestCOM.asp, line 8
>
> The call to Server.CreateObject failed while checking permissions. Access
> is denied to this object.
>
> ====================================
>
> Can you tell me step by step of this debugging process? Thanks a lot!
>
barjatiyarakesh@h...
%%email.unsub%%
>
>
Message #7 by "Nguyen Anh Tuan" <tuancan@y...> on Thu, 23 May 2002 10:21:49
Where can i get PassedScriptingContext object to pass in OnStartPage sub?
Message #8 by "Jeroen Diderik" <jeroen@i...> on Thu, 23 May 2002 15:55:13 +0200
Make sure that the permissions on the virual directory on your website
are NOT set to allow anonymous access!!!

If you develop for  IIS 4 or higher I recommend using ObjectContext
instead of ScriptingContext.
Make a reference to:
COM+ Services Type Library
Microsoft Active Server Pages Object Library

Use the following code:
Private ObjectContext As COMSVCSLib.ObjectContext
Private Request As ASPTypeLibrary.Request
Private Response As ASPTypeLibrary.Response
Private Session As ASPTypeLibrary.Session
Private Application As ASPTypeLibrary.Application
Private Server As ASPTypeLibrary.Server

Private Sub Class_Initialize()
    Set ObjectContext =3D GetObjectContext()
    Set Response =3D ObjectContext("Response")
    Set Request =3D ObjectContext("Request")
    Set Session =3D ObjectContext("Session")
    Set Application =3D ObjectContext("Application")
    Set Server =3D ObjectContext("Server")
End Sub

Private Sub Class_Terminate()
   Set ObjectContext =3D Nothing
   Set Request =3D Nothing
   Set Response =3D Nothing
   Set Session =3D Nothing
   Set Application =3D Nothing
   Set Server =3D Nothing
End Sub

Read the following for more info:
http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/dnserv
/
html/server01242000.asp

Gr,
Jeroen Diderik


-----Original Message-----
From: Rakesh [mailto:barjatiyarakesh@h...]
Sent: Friday, May 24, 2002 7:56 AM
To: ASP components
Subject: [asp_components] Re: How can i debug VB Components?


to making asp component you have to include asp.dll in your project.And
folowing code in your class to include asp.dll into project  in vb
project>>preferences>>Microsoft Active Server Pages. ##################
Code ###########333

   Private MyScriptingContext As ScriptingContext
   Private MyApplication As Application
   Private MyRequest As Request
   Private MyResponse As Response
   Private MyServer As Server
   Private MySession As Session
   Private rs As Recordset

Public Sub OnStartPage(PassedScriptingContext As ScriptingContext)
    Set MyScriptingContext =3D PassedScriptingContext
    Set MyApplication =3D MyScriptingContext.Application
    Set MyRequest =3D MyScriptingContext.Request
    Set MyResponse =3D MyScriptingContext.Response
    Set MyServer =3D MyScriptingContext.Server
    Set MySession =3D MyScriptingContext.Session
End Sub


Public Sub OnEndPage()           ' -------This Procedure is optional it
is
just example
    Set MyScriptingContext =3D Nothing
    Set MyApplication =3D Nothing
    Set MyRequest =3D Nothing
    Set MyResponse =3D Nothing
    Set MyServer =3D Nothing
    Set MySession =3D Nothing
    Set rs =3D Nothing
    Set Conn =3D Nothing
End Sub

Public Sub test1()
    '----- Declare the variables used in this Sub
    Dim strVariable As String
    Dim intCount As String
    '----- Get the Query String, if any, and increase it by one
    intCount =3D MyRequest.Form("UserName")
    '----- Constuct the HTML code to send back to the browser
    strVariable =3D "Your UserName is :-<b>"
    strVariable =3D strVariable & intCount & "</b>"
    '----- Send the constructed HTML code
    MyResponse.Write (strVariable)
End Sub



################3333333


Rakesh

----- Original Message -----
From: "Nguyen Anh Tuan" <tuancan@y...>
To: "ASP components" <asp_components@p...>
Sent: Wednesday, May 22, 2002 9:59 AM
Subject: [asp_components] How can i debug VB Components?


> How can i debug VB Components?
>
> This is my process:
>
> + Compile my component
> + Register it in MTS
> + Write an ASP page to create an instance of my object, then set that
> + page
> in Project/Debugging option in VB
> + Press Ctrl + F5 for Full Compile
>
> ASP Code:
>
> <%@ Language=3DVBScript %>
> <html>
> <head>
> </head>
> <body>
>
> <%
>     Set myGrid =3D Server.CreateObject("myGrid.TextOnly") ' Line 8
>
>     Call myGrid.Generate()
> %>
>
> </body>
> </html>
>
> 
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
> But browser show that error:
>
> Server object error 'ASP 0178 : 80070005'
>
> Server.CreateObject Access Error
>
> /myGrid/TestCOM.asp, line 8
>
> The call to Server.CreateObject failed while checking permissions.
> Access is denied to this object.
>
> 
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
> Can you tell me step by step of this debugging process? Thanks a lot!
>
barjatiyarakesh@h...
%%email.unsub%%
>
> ---
> Change your mail options at http://p2p.wrox.com/manager.asp or to
> unsubscribe send a blank email to
>


%%email.unsub%%


Message #9 by "Nguyen Anh Tuan" <tuancan@y...> on Thu, 23 May 2002 16:38:46
Bless you, give it to your own. Ha ha! I think you must try 4D for ASP 
Component!
Message #10 by "Nguyen Anh Tuan" <tuancan@y...> on Thu, 23 May 2002 16:51:17
Ho ho, i knew. Microsoft's stupid. If you install VB6 SP5, it never shows 
my error.
Message #11 by "J House" <jesse@s...> on Sat, 25 May 2002 22:55:09
You may want to look at this article 
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q250309

"Do Not Use ObjectContext in Class_Initialize and Class_Terminate Events 
(Q250309)"

it recommends that you use ObjectControl_Activate() and 
ObjectControl_Deactivate()

I personnally don't use either. I declare and create all objects within 
each method call.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I recommend using ObjectContext
instead of ScriptingContext.
Make a reference to:
COM+ Services Type Library
Microsoft Active Server Pages Object Library

Use the following code:
Private ObjectContext As COMSVCSLib.ObjectContext
Private Request As ASPTypeLibrary.Request
Private Response As ASPTypeLibrary.Response
Private Session As ASPTypeLibrary.Session
Private Application As ASPTypeLibrary.Application
Private Server As ASPTypeLibrary.Server

Private Sub Class_Initialize()
    Set ObjectContext =3D GetObjectContext()
    Set Response =3D ObjectContext("Response")
    Set Request =3D ObjectContext("Request")
    Set Session =3D ObjectContext("Session")
    Set Application =3D ObjectContext("Application")
    Set Server =3D ObjectContext("Server")
End Sub

Private Sub Class_Terminate()
   Set ObjectContext =3D Nothing
   Set Request =3D Nothing
   Set Response =3D Nothing
   Set Session =3D Nothing
   Set Application =3D Nothing
   Set Server =3D Nothing
End Sub

  Return to Index