title: Communication from a C# application to an ASP.NET application
body: <p>I'm creating a host application (C#) for a ASP.NET application. What I'd like to accomplish is having the ASP application getting events from the C# application. With this data I need to call a server side function with the HTTP Context/session from the ASP client side. It's possible to just refresh the page with a querystring.</p>
  
  <p>I currently have two approaches:</p>
  
  <p>1) C# WCF with net.tcp to ASP
  <img src="https://i.stack.imgur.com/9mN6T.png" alt="Communication overview - net.tcp C# to ASP.NET">
  Issue: Session (HTTP context) is NULL when directly contacting the server side layer. I can update static variables and so on, but I'm not able to tell the client side to refresh/navigate with a querystring (so I can get the context at next page_load). </p>
  
  <p>2) C# WebBrowser.Document.InvokeScript(myJavascript())
  <img src="https://i.stack.imgur.com/sA9px.png" alt="C# WebBrowser.Invoke to JS"></p>
  
  <p>Issue: I'm not able to reach static variables (they're for some reason NULL) when I reach the server side on the ASP application. I've tried using Session["MyVariable"] = "test"; in a page_load, invoke the javascript function and check the session variable, but this is NULL. </p>
  
  <p>Any help or pointings to the right direction would be very helpful. If needed I'll attach some code examples.</p>
  
  <p>Thanks!</p>
  
  <p>Edit 1:
  From my WebBrowser all I can see is the Default.aspx page, so when creating javascript function from issue #2, I need to create this in this file. If not I'm not able to invoke it. </p>