Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7907497
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T11:28:17+00:00 2026-06-03T11:28:17+00:00

We have a number of classic ASP websites using a VB6 DLL (COM) object

  • 0

We have a number of classic ASP websites using a VB6 DLL (COM) object for their functionality in the standard way. The DLL is regsvr32’d and the pages use Server.CreateObject to create an instance of the necessary object in the DLL, which in turn triggers the OnStartPage function of the object being created, passing in the ScriptingContext which we then use to get Request (querystring, form) information, read/update session information and read/write cookie information (etc). For clarification, the way you update/store a cookie value using ScriptingContext is

objSC.Response.Cookies(Key) = Value

In preperation of doing a complete .Net overhaul on the code base (and as a first step), we ran the code through the .Net 2008 VB upgrade tool, which makes a few minor code changes, sets up references to interop libraries (for ADODB, ASPTypeLibrary, CDO, etc) and adds the necessary attributes to allow the .Net object to be exposed to COM, and after a few tweaks here and there guided by comments (todos) left by the upgrade tool, the code is compilable except for anything that tried to update/store a cookie using the above code as now, through the ASPTypeLibrary (Interop), the Response.Cookies collection is readonly (with no obvious way to write a cookie now).

If I comment out the offending line of code, the code compiles, and all I need to do is register this new .Net DLL (and it’s interop DLLs) in the GAC, use regasm to register it through COM and the classic ASP sites continue working as if nothing happened (except for writing cookies), using Server.CreateObject to create what it thinks is a COM object, triggering the call to OnStartPage, passing in the ScriptingContext.

So although the code base is “upgraded” to .Net it is using a lot of interop libraries to continues working as before, including using the ASPTypeLibrary.ScriptingContext object, as this is what the classic ASP pipeline exposes.

Does anyone know how to write/store a cookie in this scenario?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T11:28:19+00:00Added an answer on June 3, 2026 at 11:28 am

    Need to convert cookie item to IWriteCookie interface. Then it will be writable.

    Imports ASPTypeLibrary
    Public Class Test
        Private oContext As ASPTypeLibrary.ScriptingContext
        Private oResponse As ASPTypeLibrary.Response
        Public Sub OnStartPage(e As ScriptingContext)
            oContext = e
            oResponse = oContext.Response
            With CType(oResponse.Cookies("fromdotnet"), IWriteCookie)
                .Item = String.Format("hello from .Net : {0}", Date.UtcNow())
                '.Domain = ""
                '.Path = "/"
                '.Secure = False
            End With
        End Sub
    End Class
    

    You may want to check out other interfaces such as IReadCookie, IStringList, IRequestDictionary etc.

    With note that:

    Full trust for the immediate caller. This member cannot be used by partially trusted code.

    there is another option : ContextUtil.GetNamedProperty Method

    System.EnterpriseServices.ContextUtil.GetNamedProperty("Response").Cookies("fromdotnet") = "hello"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have developed a large number of websites using ASP (jscript flavour), talking to
I have to maintain a large number of classic ASP pages, many of which
We have a classic ASP application that connects to a COM component. The COM
I'm using ImageMagickObject COM+ in Classic ASP. I am trying to convert an SVG-file
In my real application, I have a VB6 DLL which is called from classic
We have a classic ASP page that is instantiating a .Net object through a
I'm using VBScript (ASP Classic) and SQL Server; I'm trying to have a section
I have a classic asp webpage written in vbscript that outputs the results from
I am working on a classic asp form that has a number of dropdowns.
I have a legacy web-site that I am maintaining (built mostly in classic ASP

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.