raje
raje

Reputation: 165

URI formats are not supported in c#

I am trying to insert my data in to xml file. the xml file location path: http://AutoCompleteInGridView%20new1/Design/Pro/pricelist.xml. when inserting my data i got error URI formats are not supported. It shows argument exception was unhandled.I want to save my xml file in server system.these url belongs to ServerPath location. can anyone give me a suggestion or links to solve these problem.

here is the error:

enter image description here

Upvotes: 4

Views: 26233

Answers (3)

Nico Leguizamon
Nico Leguizamon

Reputation: 61

you could try with this solution:

http://social.msdn.microsoft.com/Forums/en-US/eccd585a-ac2b-4700-aa28-abb4802cd3a5/uri-formats-are-not-supported-error-with-xmlsave?forum=xmlandnetfx

Basically, use

doc.Save(Server.MapPath("~/EEPPriceList/Products.xml"))

Upvotes: 0

Sorav Nayyar
Sorav Nayyar

Reputation: 1

Try like this:

string SavePathUrl = ConfigurationManager.AppSettings["SavePathUrl"];
string strFileName = DateTime.Now.ToString("dd-mmm-yyyy-hh-mm-ss-ffffff") + "^" + fileName;
File.WriteAllBytes(new Uri(SavePathUrl).AbsoluteUri + strFileName, Convert.FromBase64String(base64String));
return strFileName;

Upvotes: 0

user1968030
user1968030

Reputation:

Use this sample:

                string uriPath = "YourAddress/pricelist.xml";
                string  localPath = new Uri(uriPath).LocalPath;

Upvotes: 2

Related Questions