问题
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:
回答1:
Use this sample:
string uriPath = "YourAddress/pricelist.xml";
string localPath = new Uri(uriPath).LocalPath;
回答2:
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;
回答3:
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"))
来源:https://stackoverflow.com/questions/19761944/uri-formats-are-not-supported-in-c-sharp