je veux modifier mon fichier xml qui se trouve sur le serveur , pour cela j'ai cré un service web :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 
[OperationContract]
        public string ChangerAct(string NameFich, string NameActv, string NewNameAct)
        {
 
            string chaine;
 
            try
            {
            XDocument data = XDocument.Load(HttpContext.Current.Server.MapPath(@"ClientBin/Data/" + NameFich + ".xml"));
            var req = (from c in data.Descendants("Activity")
                       where c.Attribute("ActivityName").Value.Equals(NameActv)
                       select c.Attribute("ActivityName")).FirstOrDefault().Value.ToString();
 
 
                chaine = req.ToString();
                req.Replace(chaine, NewNameAct);
                data.Save(HttpContext.Current.Server.MapPath(@"ClientBin/Data/" + NameFich + ".xml"));
            }
            catch (Exception ex)
            {
                return ex.ToString();
            }
            return chaine;   
        }
Alrors mon but est de remplacer NameAc par NewNameAc , malheureusement ça marche pas !!! je sais pas qu'elle est le problème
Merci de m'aider
Cordialement