0

I have defined a method in my application, codes are as shown below

protected string getOptions()
        {
            StringBuilder stringbuilder = new StringBuilder();
            XmlDocument xml = new XmlDocument();
            xml.Load(ConfigurationManager.AppSettings["TicketCreatorXMLFile"]);
            XmlNodeList nl = xml.GetElementsByTagName("ticketCreator");
            foreach (XmlNode n in nl)
            {
                stringbuilder.AppendFormat("<TR class='item off'><TD class=Loff style='WIDTH: 25px'><INPUT id={0} title=opt{0} type=radio name=optns onclick='curVal=this.title'></TD><TD class=Roff>{1}</TD></TR>", n.Attributes["templateId"].InnerText, n.Attributes["title"].InnerText);
            }
            return stringbuilder.ToString();
        }

and the TicketCreatorXMLFile value in Web.config is defined as below-

 <add key="TicketCreatorXMLFile" value="http://localhost:40/crmrequest/TicketCreators.xml"/>

TicketCreatorXMLFile is hosted in IIS at the same location as mentioned above and I am able to browse it at the same address.

when I run the application in house it works perfectly fine, but when I deployed it on one of our site areas it threw error

System.ArguementException: URI Formats are not supported

I am not sure about what could be wrong.

Loofer
  • 6,841
  • 9
  • 61
  • 102

1 Answers1

0

http://localhost:40 is your local server address, so it works in your local server. But it's not your deployed server address..

If your file is a local file in the server i would use

xml.Load(Server.MapPath(ConfigurationManager.AppSettings["TicketCreatorXMLFile"])));

and define you configuration as

 <add key="TicketCreatorXMLFile" value="~/crmrequest/TicketCreators.xml"/>
DaniCE
  • 2,412
  • 1
  • 19
  • 27