title: Asp.net code not performing on actual server as localhost
body: <p>I have the following code that works fine on my localhost using IIS7 but when i upload it to my server it is behaving not the same as it did on my localhost
   For example the submit button when clicked should check validation which it does on my localhost and then redirects to a URL if the validation is correct</p>
  
  <p>But when the same is tried on the actual server over here
  <a href="http://www.singaporetelugusamajam.org/entercontact.aspx" rel="nofollow">The not working link</a></p>
  
  <p>the problem started when i introduced a redirect url (in C# code is Response.Redirect("http://www.google.com");)  in to the c# code...if there is a better way to do this all this hassle wont be necessary..tks</p>
  
  <p>this is the code that i used</p>
  
  <pre><code>&lt;%@ Page Language="C#" Debug="true" %&gt;
  &lt;%@ Import Namespace="System.Xml" %&gt;
  
  &lt;script runat="server"&gt;
  
  
  protected void btnSave_Click(object sender, EventArgs e)
  {
      txtAddress.Text = "";
      string xmlPath = MapPath("Books.xml");
      XmlDocument doc = new XmlDocument();
      //Check if the file already exists or not
      if (System.IO.File.Exists(xmlPath))
      {
          doc.Load(xmlPath);
          XmlNode bookNode = CreateBookNode(doc);
          //Get reference to the book node and append the book node to it
          XmlNode bookStoreNode = doc.SelectSingleNode("bookstore");
          bookStoreNode.AppendChild(bookNode);
          lblResult.Text = "XML Document has been successfully updated";
          txtAddress.Text = ""; Response.Redirect("http://www.google.com");
      }
      else
      {            
          XmlNode declarationNode = doc.CreateXmlDeclaration("1.0", "", "");
          doc.AppendChild(declarationNode);
          XmlNode comment = doc.CreateComment("This file represents a fragment of a book store inventory database");
          doc.AppendChild(comment);            
          XmlNode bookstoreNode = doc.CreateElement("bookstore");
          XmlNode bookNode = CreateBookNode(doc);                        
          //Append the book node to the bookstore node            
          bookstoreNode.AppendChild(bookNode);
          //Append the bookstore node to the document
          doc.AppendChild(bookstoreNode);
          lblResult.Text = "XML Document has been successfully created";
          txtAddress.Text = "";Response.Redirect("http://www.google.com");
      }
      doc.Save(xmlPath);
  
  
  
  }
  
  XmlNode CreateBookNode(XmlDocument doc)
  {
  
      /* 
       XmlNode bookNode = doc.CreateElement("book");
       //Add the genre attribute to the book node
       XmlAttribute genreAttribute = doc.CreateAttribute("genre");
       genreAttribute.Value = txtGenre.Text;        
       bookNode.Attributes.Append(genreAttribute);
  
       http://www.java2s.com/Code/ASP/XML/SaveformdatatoXMLfile.htm
  
       */
  
  
      XmlNode bookNode = doc.CreateElement("book");
  
      //Declaration of the Main Node (Particulars)
      XmlNode particularsnode = doc.CreateElement("Particulars");
      //Declaration of Child Nodes in the Main Node(Particulars)
      XmlNode nameNode = doc.CreateElement("Name");
      XmlNode phoneNode = doc.CreateElement("Phone");
      XmlNode emailNode = doc.CreateElement("Email");
      XmlNode AddressNode = doc.CreateElement("Address");
      //Getting the textvalue from the htmlform
      nameNode.InnerText = txtName.Text;
      phoneNode.InnerText = txtPhone.Text;
      emailNode.InnerText = txtEmail.Text;
      AddressNode.InnerText = txtAddress.Text;
      //Updating the XML file here the particularsnode has various children and they are being updated
      particularsnode.AppendChild(nameNode);
      particularsnode.AppendChild(phoneNode);
      particularsnode.AppendChild(emailNode);
      particularsnode.AppendChild(AddressNode);
      bookNode.AppendChild(particularsnode);
  
  
      //Declaration of the Main Node (BookParticulars)
      XmlNode bookparticularsnode = doc.CreateElement("BookParticulars");
      //Declaration of Child Nodes in the Main Node(BookParticulars)
      XmlNode schoolNode = doc.CreateElement("School");
      XmlNode currentlevelNode = doc.CreateElement("CurrentLevel");
      XmlNode GABDNode = doc.CreateElement("GiveAwayBookDetails");
      XmlNode LRNode = doc.CreateElement("LevelRequired");
      //Getting the textvalue from the htmlform
      schoolNode.InnerText = txtSchool.Text;
      currentlevelNode.InnerText = txtCurrentLevel.Text;
      GABDNode.InnerText = txtGABD.Text;
      LRNode.InnerText = txtLR.Text;
      //Updating the XML file here the particularsnode has various children and they are being updated
      particularsnode.AppendChild(schoolNode);
      particularsnode.AppendChild(currentlevelNode);
      particularsnode.AppendChild(GABDNode);
      particularsnode.AppendChild(LRNode);
      bookNode.AppendChild(bookparticularsnode);
  
  
  
      return bookNode;
  }
  public static string NewLineToBreak(string input)
  {
      Regex regEx = new Regex(@"[\n|\r]+");
      return regEx.Replace(input, "&lt;br /&gt;");
  }
  
  protected void txtAddress_Load(object sender, EventArgs e)
  {
      txtAddress.Text = "Woodlands Drive 14\n Blk";
  }
  &lt;/script&gt;
  </code></pre>