Salut
J'ai construi dinamiquement un sitemap donc j'ai un fichier .aspx qui me forni le sitemap. Voila je voudrai savoir si c'est possiblie fair le load du sitemap dans mon menu1
est apres dans le page load j'ai:
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 StringBuilder sb = new StringBuilder(); sb.AppendLine("<?xml version=\"1.0\" encoding=\"utf-8\"?>"); sb.AppendLine("<siteMap xmlns=\"http://schemas.microsoft.com/AspNet/SiteMap-File-1.0\">"); BusinessLayer.Utilities.SiteMap sm = new BusinessLayer.Utilities.SiteMap(); //ciclo de pai index 0 e filho index 1...N foreach (Datalayer.TblSegMenu ..................... sb.AppendLine("</siteMapNode>"); } sb.AppendLine("</siteMap>"); ASCIIEncoding encoding = new System.Text.ASCIIEncoding(); return encoding.GetBytes(sb.ToString());
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 protected void Page_Load(object sender, EventArgs e) { byte[] fileget = GetXMLSiteMap(); Response.Clear(); Response.AddHeader("Content-Length", fileget.Length.ToString()); Response.ContentType = "application/octet-stream"; try { Response.Charset = "utf-8"; } catch { } if (fileget.Length > 0) Response.OutputStream.Write(fileget, 0, fileget.Length); }
Partager