Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 905521
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T16:14:02+00:00 2026-05-15T16:14:02+00:00

I am making a page that accepts post data from any number of pages

  • 0

I am making a page that accepts post data from any number of pages that I cannot change, access, or in any way control.

I need, in one way or another, to get the timezone of the user. I know, ideally the posting page would do this, but I cannot access these pages.

I’ve read other answers on this site and come up with 2 almost, but not quite there solutions.

First, there is javascript. I can get the javascript function to return (or change a label to) the correct value, but the problem is I need this info before the postback. I’ve been trying to write the timezone name on another page and read that page, but I have no idea how to begin to do that? Any other workaround to use the javascript is welcome, or any way to force call this before Page_Load is called?

    function getTimeZone()
    {
       var d = new Date()
       var gmtHours = -d.getTimezoneOffset()/60;
       var label = document.getElementById("<%=TZ.ClientID%>");
       label.textContent = "GMT " + gmtHours;
    }

The second solution is to read it from another page, and I am using this:

http://ipinfodb.com/ip_query.php?ip=192.36.167.120&timezone=true

(Completely random ip in there, btw)

So here is my function to get the info from that site:

        public string GetTimezone(string ip)
    {
        string address = string.Format("http://ipinfodb.com/ip_query.php?ip={0}&timezone=true", ip);
        string timezone = "";

        try
        {
            XmlTextReader reader = new XmlTextReader(address);
            HttpWebRequest wrq = (HttpWebRequest)WebRequest.Create(address);
            wrq.Proxy.Credentials = CredentialCache.DefaultCredentials;
            reader = new XmlTextReader(wrq.GetResponse().GetResponseStream());

            string lastRead = "";
            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    lastRead = reader.Name;
                }
                if (reader.NodeType == XmlNodeType.Text)
                {
                    if (string.Compare(lastRead, "TimezoneName", true) == 0)
                    {
                        timezone = reader.Value;
                        break;
                    }
                }
            }
        }
        catch
        {
            timezone = "";
        }

        return timezone;
    }

Basically, this works in debug mode, but when it’s live only an empty string is returned. I am baffled? Is there any better way to read data from a page? I am using Request.ServerVariables[“REMOTE_ADDR”] to get the ip, and that seems to be correct, since it inserts the correct ip into the database I’m using.

Here is the call:

GetTimezone(Request.ServerVariables["REMOTE_ADDR"]);
  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T16:14:02+00:00Added an answer on May 15, 2026 at 4:14 pm

    You’re getting an exception, probably because of a trust issue / firewall on the production server.

    Get rid of the evil catch block so you can find out what the exception is.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making an ASP.NET Web page that generates pages from SQL when they're not
I am making a web page that displays fragments of text from news sites
I am making an page that will automatically display the number of subscribers for
I am making a page that displays data in the form of a heatmap.
I am making a web page that displays large sets of data. Initially, the
I'm making an aspx page that can edit books. A book is an complex
I am making a web page in that I have used Ajax calendar to
I am interested in making some sort of HTML page that displays the name
i'm making app that the main page include TableView but i want when i
I am making a chrome extension that will open all links on a page

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.