在C#中创建快捷方式时的路径操作

时间:2012-11-21 05:16:48

标签: c#-4.0

使用下面的代码我正在创建一个快捷方式。当我运行HP fortify工具时,我正在为突出显示的代码获取路径操作问题。我是新手。任何人都可以告诉我如何纠正它。我的意思是什么路径操纵正在发生。

string fileName = new data()。getdata(object_id,Cid,id_pluf).Tables [0] .Rows [0] [&#34; Name&#34;] +&#34; url&#34;; < / p>

            **var fs = new System.IO.FileStream(start + fileName, System.IO.FileMode.Create);**
            fs.Write(bytes, 0, bytes.Length);
            fs.Flush();
            fs.Close();

     private static void DeleteShortcut(string start, string fileName)
        {
            **if (System.IO.File.Exists(start+ fileName))**
            {

                **System.IO.File.Delete(start+ fileName);**
            }
        }

1 个答案:

答案 0 :(得分:0)

始终使用:

Path.Combine(start, fileName) 

而不是:

start+ fileName