Is it possible to access a variable declared in c# in an html page
-
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.
-
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.
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 -
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.
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, likePage.Request.Url.Host
. If you like, the best place to store this would be in thePage.Application
property - kind of like a session variables only they apply to the whole application so that the application can query the variables (likePage.Application["IPAddress"]
) and get the same thing everywhere.Microsoft MVP, Visual C# My Articles