dcsimg
Results 1 to 6 of 6

Thread: Mswc.adrotator does not create object With iis10 in classic asp

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2019
    Posts
    15

    Mswc.adrotator does not create object With iis10 in classic asp

    Hello:

    I am using iis10 on 64bits system to create ad rotator object with 32bit classic ASP.

    Initially, the adRot.dll was missing on my windows 10 system So I copied the old adrot.dll from my XP system and I installed it on my new windows 10 computer.
    I don’t remember what method I initially used to install the adrot.dll which I had copied from my XP system. Now that the dll was not working anymore, I uninstalled the adrot.dll and I reinstalled it using the commands:
    c:\windows\sysWow64 > Regsvr32 /u c:\windows\sysWow64.dll
    c:\windows\sysWow64 > Regsvr32 c:\windows\sysWow64.dll
    I also installed the adroit.dll in c:\windows\system32 folder.

    But the problem persists and the adRotator object is not created on my classic ASP page when executing the following line:
    Dim myAds: set myAds = Server.CreateObject(“MSWC.adRotator”)
    So that typename(myAd) return the string “Empty” and so ads are not displayed. Also the error objectes throws “Object required” when the following line is executed:
    Response.write myAd.getAdvertisement(myAds.txt)

    Would any expert be able to tell me why the adRotator object is not created anymore and how could I resolve this issue?

    Your help is greatly appreciated.
    Thank you,

  2. #2
    Fanatic Member
    Join Date
    Nov 2017
    Posts
    1,006

    Re: Mswc.adrotator does not create object With iis10 in classic asp

    Chatter on the internet regarding that particular dll seems to indicate that it stopped functioning in IIS7 (in Windows 2008 Server/Windows Vista)

    It shouldn't be that difficult to write a few lines of asp code that will read in the contents of myAd.txt and display a randomly selected ad from the list.

  3. #3
    Fanatic Member
    Join Date
    Nov 2017
    Posts
    1,006

    Re: Mswc.adrotator does not create object With iis10 in classic asp

    It had been a while since I had an excuse to do anything with classic ASP, so I wrote a quick and dirty replacement for basic AdRot functionality. Note that any specific directives that may exist in the ad file above the "*" are ignored. Also, I have hardcoded the maximum number of ads at 101 for testing. Worked great in my testing, hopefully it gets you on the right track.


    Code:
    <HEAD>
    
    <%
    
    Function getAdvertisement(af)
      
      Dim img(100)
      Dim url(100)
      Dim aText(100)
      Dim weight(100)
      Dim count
      Dim totWeight
      Dim MyFileObj
      Dim AdFilePath
      Dim AdFile
      Dim r
      Dim i
      Randomize
    
      Set MyFileObj=Server.CreateObject("Scripting.FileSystemObject")
      AdFilePath=Server.MapPath(af)
      Set AdFile=MyFileObj.OpenTextFile(AdFilePath,1)
    
      'Skip adfile header info
      Do While AdFile.ReadLine <> "*" And Not AdFile.AtEndOfStream
      Loop
    
      count = 0
      totWeight = 0
    
      'Get details for each ad item
      Do While Not AdFile.AtEndOfStream
        img(count) = AdFile.ReadLine
        url(count) = AdFile.ReadLine
        aText(count) = AdFile.ReadLine
        totWeight = totWeight + AdFile.ReadLine
        weight(count) = totWeight
        count = count + 1
      Loop
      AdFile.Close
    
      'Select the random ad to display
      r = Rnd * totWeight
      For i = 0 To count - 1
        'Response.Write(r)
        If r < weight(i) Then
          getAdvertisement = "<A HREF=" + Chr(34) + url(i) + Chr(34) + ">" + _
                             "<IMG SRC=" + Chr(34) + img(i) + Chr(34) + _
                             " ALT=" + Chr(34) + aText(i) + Chr(34) + "></A>"
          Exit For
        End If
      Next
    
    End Function
    
    %>
    
      <BODY>
    
        <% Response.Write(getAdvertisement("ads.txt")) %>
    
      </BODY>
    
    </HTML>

  4. #4

    Thread Starter
    New Member
    Join Date
    Jan 2019
    Posts
    15

    Re: Mswc.adrotator does not create object With iis10 in classic asp

    Very nice piece of code.
    I never thought about writing the code as I thought adrot dll is supposed to be available.
    Your code looks simple and neat and thank you for that although I don’t know if it’s execution time differs from the function of the dll. I also reinstalled the dll and it works now.

  5. #5

    Thread Starter
    New Member
    Join Date
    Jan 2019
    Posts
    15

    Re: Mswc.adrotator does not create object With iis10 in classic asp

    Very nice piece of code.
    I never thought about writing the code as I thought adrot dll is supposed to be available.
    Your code looks simple and neat and thank you for that although I don’t know if it functionS as fast as the dll. I also reinstalled the dll and it works now.

  6. #6
    Fanatic Member
    Join Date
    Nov 2017
    Posts
    1,006

    Re: Mswc.adrotator does not create object With iis10 in classic asp

    Nice!

Tags for this Thread

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width