troubleshooting Question

Urgent - Passing the Context object to a DLL

Avatar of BenClark
BenClark asked on
ASP.NET
1 Comment1 Solution777 ViewsLast Modified:
Very Urgent Please!!!!

I have a DLL (Class Library) written in VB.NET that I want to call various
methods from a ashx handler.
What I want to do is pass the context object to the DLL and let it go through
all the QueryString, etc.. stuff and gather all the info for processing since the
DLL is already compiled (CRL).
This way, the ashx page only has to have 2 or 3 lines and then it can pass the
context object on to the DLL for processing.
However, the ashx defines the context object as 'System.Web.HttpContext'
In the DLL, there is NO 'System.Web.HttpContext' object.
There is 'System.Net.Http????' and even a 'System.Net.HttpContextListener'.
However, the aspx page will not build.

How can I pass the context object to my DLL so I can extract all the info I need?
        If context.Request.RequestType.ToUpper = "GET" Then
            xtw.WriteAttributeString("METHOD", context.Request.QueryString("Request"))
            xtw.WriteAttributeString("POINT", context.Request.QueryString("Point"))
        ElseIf context.Request.RequestType.ToUpper = "POST" Then
            xtw.WriteAttributeString("METHOD", context.Request.Form("Request"))
            xtw.WriteAttributeString("POINT", context.Request.Form("Point"))
        End If
       
        RequestDataStart(xtw)
       
        RequestData(xtw, "UserHostAddress", context.Request.UserHostAddress)
        RequestData(xtw, "UserHostName", context.Request.UserHostName)
        'RequestData(xtw, "UrlReferrer", context.Request.UrlReferrer.ToString)
        RequestData(xtw, "RequestType", context.Request.RequestType)
        RequestData(xtw, "ApplicationPath", context.Request.ApplicationPath)
        RequestData(xtw, "HttpMethod", context.Request.HttpMethod)
        RequestData(xtw, "IsAuthenticated", context.Request.IsAuthenticated.ToString)
       
        If context.Request.RequestType.ToUpper = "GET" Then
            Dim MaxCount As Int32 = context.Request.QueryString.Count - 1
            For Count As Int32 = 0 To MaxCount
                RequestData(xtw, context.Request.QueryString.Keys(Count), context.Request.QueryString.Item(Count))
            Next Count
        ElseIf context.Request.RequestType.ToUpper = "POST" Then
            Dim MaxCount As Int32 = context.Request.Form.Count - 1
            For Count As Int32 = 0 To MaxCount
                RequestData(xtw, context.Request.Form.Keys(Count), context.Request.Form.Item(Count))
            Next Count

Thanks in advance.
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 1 Comment.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros