Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Is it possible to access a variable declared in c# in an html page

Is it possible to access a variable declared in c# in an html page

Scheduled Pinned Locked Moved C#
csharphtml
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    VIJAYPAPUPAGER
    wrote on last edited by
    #1

    I am designing an html redirector page now since the ip of my computer keeps on changing i developed an application to detect whenever there is a change in my computers ip address this ip address is stored in a variable in my application now i want to put this variable in html redirector page is it possible.

    N H 2 Replies Last reply
    0
    • V VIJAYPAPUPAGER

      I am designing an html redirector page now since the ip of my computer keeps on changing i developed an application to detect whenever there is a change in my computers ip address this ip address is stored in a variable in my application now i want to put this variable in html redirector page is it possible.

      N Offline
      N Offline
      Nick Parker
      wrote on last edited by
      #2

      VIJAYPAPUPAGER wrote: I am designing an html redirector page now since the ip of my computer keeps on changing i developed an application to detect whenever there is a change in my computers ip address this ip address is stored in a variable in my application now i want to put this variable in html redirector page is it possible. If you are writing an application that requires a static IP then you should pay the extra money and get it, DHCP shouldn't be used when a static IP is required. That said, I suppose you could write a quick app that would poll your system for its IP address and store it in a hard file, whatever style you want, be it HTML, XML or your own flavor. It just doesn't appear to be a sound solution to your problem though. - Nick Parker
        My Blog

      1 Reply Last reply
      0
      • V VIJAYPAPUPAGER

        I am designing an html redirector page now since the ip of my computer keeps on changing i developed an application to detect whenever there is a change in my computers ip address this ip address is stored in a variable in my application now i want to put this variable in html redirector page is it possible.

        H Offline
        H Offline
        Heath Stewart
        wrote on last edited by
        #3

        In addition to what Nick said, you don't need to tell the ASP.NET application what your IP address is. It already knows. From with your page or control, just call Page.Request.ServerVariables["SERVER_NAME"]. This gets the hostname or IP address. There's other ways to get this, too, like Page.Request.Url.Host. If you like, the best place to store this would be in the Page.Application property - kind of like a session variables only they apply to the whole application so that the application can query the variables (like Page.Application["IPAddress"]) and get the same thing everywhere.

        Microsoft MVP, Visual C# My Articles

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups