No announcement yet.

IIS C# Example

  • Filter
  • Time
  • Show
Clear All
new posts

    IIS C# Example

    I have an IIS server setup and working (serving HS pages) using the VB.Net examples on this forum. But I'd like to code some C# pages. I think a C# page can reference a Global.asax page written in VB.Net, but I'm having trouble with the syntax in C#.

    For example, in a VB.Net page, I would have this in the code-behind page:

    dim hs as object
    Sub Page_Load(Sender As Object, E As EventArgs)
    hs = Global.ASP.global_asax.hs
    Label1.Text = "HomeSeer Ver: " & hs.version
    End Sub

    In C#, I assume I'd code the first line as:
    object hs = new object();

    But how do you code the reference to the Global.ASP.global_asax.hs in C#?

    I was beat up over this for the longest time. I could see the remoting proxy while debugging but had no access to it within the page. I ended up creating a static Global.cs class and shoved it into the App_Code. With that I was able to establish and set a hs channel via the Global.asax and also to reference Global.hs from any web page.

    My only experimentation thus far is iterating the devices. What puzzles me is that nowhere did I ever establish a "connection" to hs with credentials.
    Last edited by blacet; December 5, 2010, 07:04 PM. Reason: spelling