4

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

raje
  • 175
  • 2
  • 3
  • 11

3 Answers3

2

Use this sample:

                string uriPath = "YourAddress/pricelist.xml";
                string  localPath = new Uri(uriPath).LocalPath;
  • Hi Shahrooz, these one is for localpath but i need solution for server path.can you give a suggestion. – raje Nov 04 '13 at 06:08
  • Thanks Jefri,i just want to save my xml file outside of my current folder.Like E:\xmlfile in server system – raje Nov 04 '13 at 06:14
  • Hi Shahrooz, please find the above image and give me a suggestion.i'm stuck here . – raje Nov 05 '13 at 09:48
0

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"))

anon
  • 4,472
  • 2
  • 32
  • 52
0

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;
Wain
  • 117,132
  • 14
  • 131
  • 151