Results 1 to 4 of 4

Thread: Preparing to Jump Out Window

  1. #1
    idover
    Guest

    Angry Preparing to Jump Out Window

    This is driving me nuts... this was working the last time that i used it... why won't this work!?!?... i have deleted a lot of code that would be useless on a forum... asp returns:

    Object variable or With block variable not set

    and the problem is the sub Test... if i comment out the objResponse line, it runs fine...

    I know that the component is instantiated, because it will execute an ado connection just fine, but when i try to use the asp intrinsic objects, it fails... any ideas?... thanks, in advance!

    Code:
    Private objApplication As Application
    Private objRequest As Request
    Private objResponse As Response
    Private objServer As Server
    Private objSession As Session
    
    Public Sub OnStartPage(sc As Object)
    
        Set objApplication = sc.Application
        Set objRequest = sc.Request
        Set objResponse = sc.Response
        Set objServer = sc.Server
        Set objSession = sc.Session
                
    End Sub
    
    Public Sub Test()
    
        objResponse.Write "THIS IS A TEST"
        
    End Sub
    
    Public Sub OnEndPage()
    
        Set objApplication = Nothing
        Set objRequest = Nothing
        Set objResponse = Nothing
        Set objServer = Nothing
        Set objSession = Nothing
        
    End Sub

  2. #2
    idover
    Guest
    quick note: yes i made the proper reference to Active Server Pages Library... thanks...

  3. #3
    CMangano
    Guest
    This is pretty funny. Not funny cause you are struggling, but funny cause I was struggling with this same exact thing for the last 2 days! I never could get it to work with the ScriptingContext, but I got it to work with the ObjectContext (ScriptingContext works in all versions of IIS, OjbectContext is in IIS4+ and used for MTS).

    Anyways, you need to also make a reference to the MTS Object Library (mtxas.dll). Then the code you need is as follows (I will only show it for Response, it works the same for all objects):


    Dim objContext As ObjectContext
    Dim objResponse As Response

    Public Sub Class_Initialize()
    Set objContext = GetObjectContext()
    Set objResponse = objContext("Response")
    End Sub

    Public Sub WriteText()
    objResponse.Write ("whatever")
    End Sub

    As a final note, if for some reason you cannot use ObjectContext, the real problem I was having was because I was using VB6. VB6 has that cool run program where you can run the dll on a web page without first registering it. Using the ASP objects did not work till I registered it, so you may want to try that also, if you haven't already.

    HTH

  4. #4
    idover
    Guest
    hi, and thanks for your response... you'll see how i resolved this problem at this post:

    http://161.58.186.97/showthread.php?s=&threadid=80994

    thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width