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

  • Home
  • SEARCH
  • 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 6889093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:06:44+00:00 2026-05-27T06:06:44+00:00

I have an asp.net website which when i put it up on my college

  • 0

I have an asp.net website which when i put it up on my college server gave me an error when i retireved the inner text of an xml element and converted it to date which should be selected on the calender control.
The error i recieve is-

String was not recognized as a valid DateTime.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: String was not recognized as a valid DateTime.

Source Error:

Line 91:                 displayEvent.Text += "<b>On-</b>" + node.SelectSingleNode("date").InnerText + "<br />";
Line 92:                 displayEvent.Text += "<b>Contact Number-</b>" + node.SelectSingleNode("phone").InnerText + "<br />";
Line 93:                 DateTime dts1 = Convert.ToDateTime(node.SelectSingleNode("date").InnerText);
Line 94:                 Calendar1.SelectedDate = dts1;
Line 95:                 latitude = node.SelectSingleNode("latitude").InnerText;

The xml file looks like-

<root1><data><event_name>Christmas Party</event_name><event_desc>The annual christmas bash is happening as planned. This year there is bound to be more excitement.</event_desc><date>12/25/2011</date><phone>111-111-1111</phone><latitude>43.700573</latitude><longitude>-79.296661</longitude></data><data><event_name>New Year Party</event_name><event_desc>Ring in the new year with us, the party is going to be a never before event with a huge celebrity guest line up.</event_desc><date>12/31/2011</date><phone>222-222-2222</phone><latitude>43.728572</latitude><longitude>-79.48669</longitude></data><data><event_name>Jt Birthday</event_name><event_desc>It's jasmeet's birthday. He wanted to get a samsung nexus s, so i should try and buy that for him.</event_desc><date>12/11/2011</date><phone>333-333-3333</phone><latitude>45.515849</latitude><longitude>-73.553417</longitude></data></root1>

Also i am using the latitude and longitude for showing them on a map. It also has problem converting the inner texts of these elements to double

Input string was not in a correct format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.FormatException: Input string was not in a correct format.

Source Error:

Line 75:     {
Line 76:         GMap1.reset();
Line 77:         GMap1.addGMarker(new GMarker(new GLatLng(Convert.ToDouble(latitude),Convert.ToDouble(longitude))));
Line 78:         GMap1.setCenter(new GLatLng(Convert.ToDouble(latitude), Convert.ToDouble(longitude)), 6);
Line 79:         displayEvent.Text = "                                   ";

The thing that i am unable to understand is that all of this working absolutely fine on my computer. when i test it on the local server it works fine but on my college server it is giving these errors. Can anybody guide me as to what am i doing wrong here. Other parts of the website are reading from other xml files and they dont throw any exceptions. This is the latest addition of xml reading to the website, everything else works fine.
The method which is used for reading the xml file and conversion-

  protected void okButton_Click(object sender, EventArgs e)
    {
        GMap1.reset();
        GMap1.addGMarker(new GMarker(new GLatLng(Convert.ToDouble(latitude),Convert.ToDouble(longitude))));
        GMap1.setCenter(new GLatLng(Convert.ToDouble(latitude), Convert.ToDouble(longitude)), 6);
        displayEvent.Text = "                                   ";
        XmlDocument doc = new XmlDocument();
        doc.Load(Server.MapPath("Xml/try.xml"));
        XmlNodeList nodeList = doc.SelectNodes("root1/data");
        foreach (XmlNode node in nodeList)
        {
            if (node.SelectSingleNode("event_name").InnerText.Equals(DropDownList1.SelectedValue))
            {
                latitude = "";
                longitude = "";
                displayEvent.Text += "<b>Event name-</b>" + node.SelectSingleNode("event_name").InnerText + "<br />";
                displayEvent.Text += "<b>Description-</b>" + node.SelectSingleNode("event_desc").InnerText + "<br />";
                displayEvent.Text += "<b>On-</b>" + node.SelectSingleNode("date").InnerText + "<br />";
                displayEvent.Text += "<b>Contact Number-</b>" + node.SelectSingleNode("phone").InnerText + "<br />";
                Calendar1.SelectedDate = Convert.ToDateTime(node.SelectSingleNode("date").InnerText);
                latitude = node.SelectSingleNode("latitude").InnerText;
                longitude = node.SelectSingleNode("longitude").InnerText;
            }
        }
    }
  • 1 1 Answer
  • 0 Views
  • 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-27T06:06:44+00:00Added an answer on May 27, 2026 at 6:06 am

    The two computers have different regional settings. You are converting string “12/25/2011” to a DateTime value. If in Control Panel/Regional Settings short date format is dd/MM/yyyy, then 25 is interpreted as month number and the string is considered invalid, since we only have twelve. As for longitude/latitude values, my guess would be that decimal separator is set to comma on your college server. Consider using the versions of Convert.ToDateTime/ToDouble with the second IFromatProvider parameter.

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

Sidebar

Related Questions

I have an asp.net website in my production server which running fine now. Now
I have an ASP.Net website which has a remember me feature for Login page.
I have an company asp.net website with textboxes which may contain several hundred words.
I have a Silverlight web app which uses ASP.net Website administration tool for user
I have a website developed in ASP.NET and VB.NET which has a place for
I'm currently writing a website in ASP.NET MVC, and my database (which doesn't have
I have a SQL Server database which is shared between several ASP.NET (VB.NET) websites,
I have an ASP.NET website containing the following <asp:UpdatePanel ID=UpdatePanel1 runat=server > <ContentTemplate> <asp:Label
I have an asp.net website (SQL Server, Windows 2003, IIS 6) and I am
I have an asp.net website which contains a few pages that I'd like to

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.