protectedstring ParseAspxTag(string str) ...{ string s=""; int k,m,n; string strKey=""; while(str.IndexOf("<asp:")>0) ...{ k=str.IndexOf("<asp:"); m =0; n = k; while (m ==0) ...{ m = str.IndexOf(">", n); if ((str.Substring(k, m-k +1).Split('"').Length %2) ==0) ...{ n = m+1; m =0; } else ...{ strKey = str.Substring(k, m - k +1); str = str.Replace(strKey, ""); if (strKey.IndexOf("/>") <=0) ...{ strKey = strKey.Replace(">", "/>"); } break; } } strKey = strKey.Replace("<asp:", "<"); //the following code just a simple solution,if string exist some word have not '"',add it strKey = strKey.Replace("", ""); for (int l =0; l < strKey.Length; l++) ...{ if (strKey[l] =='='&&(strKey.Substring(1,l).Split('"').Length %2)==1) ...{ if (strKey[l+1] !='"') ...{ int c=strKey.IndexOf("",l); strKey = strKey.Insert(c, """); strKey = strKey.Insert(l+1,"""); l =0; } } } s += strKey +""; } s ="<?xml version="1.0" encoding="utf-8"?><Root>"+ s +"</Root>"; return s; }