2013-11-04 60 views
5

我想将我的数据插入到xml文件中。 xml文件位置 路径:http://AutoCompleteInGridView%20new1/Design/Pro/pricelist.xml。 当插入我的数据时,我得到错误URI formats are not supported。 它显示参数异常是未处理的。我想将我的xml 文件保存在server system中。这些url属于ServerPath位置。 任何人都可以给我一个建议或链接来解决这些问题。c#中不支持URI格式

这里是错误:

enter image description here

+0

退房这个问题,因为它可能会有所帮助。 http://stackoverflow.com/questions/12560664/exception-uri-formats-are-not-supported – devfunkd

+1

感谢您的答复。在该链接它给出了本地路径的解决方案,但我需要服务器路径。你能给我一个链接吗? – raje

+0

适用相同的概念,请参阅下面的答案。您需要创建字符串变量并将其传递给URI。 – devfunkd

回答

2

使用此示例:

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

嗨Shahrooz,这一个是为本地路径,但我需要解决方案的服务器path.can你给一个建议。 – raje

+0

感谢Jefri,我只是想将我的xml文件保存在我目前的文件夹之外。就像服务器系统中的E:\ xmlfile – raje

+0

嗨Shahrooz,请找到上面的图片并给我一个建议。我在这里卡住了。 – raje

0

尝试这样的:

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;