URI formats are not supported in c#

僤鯓⒐⒋嵵緔 提交于 2019-12-12 09:44:26

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!