Value of type 'System.Web.HttpContext' cannot be converted to 'System.Web.WebSockets.AspNetWebSocketContext'._


  • I am trying to convert microsoft's sample of websocket server from c# to vb.net all converts good except for one command

     Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
                If context.IsWebSocketRequest Then
                End If
            End Sub
            Public Async Function ProcessSocket(context As AspNetWebSocketContext) As Task

    I get Value of type 'System.Web.HttpContext' cannot be converted to 'System.Web.WebSockets.AspNetWebSocketContext'.

    IHow do I convert the incoming 'HttpContext' to AspNetWebSocketContext.

    in their c# code they don't even attempt to pass the context to the called function like this:


    However that throws an error because it passes no arguments to the called Function

    Monday, May 19, 2014 1:18 AM


  • You can't do this in a Windows Store app.  AspNetWebSocketContext is not in a valid namespace for Windows Store apps. I suggest that you see the Windows Store WebSocketSample.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    • Marked as answer by PBPuddin Monday, May 19, 2014 3:41 PM
    Monday, May 19, 2014 12:08 PM