Articles

Affichage des articles du mars, 2016

Comment créer un iframe redimensionable en largeur et en hauteur pour faire du responsive design ?

Définir une division d'une hauteur de 0px et d'un padding-bottom du pourcentage souhaité. Mettre l'iframe, la video embeded etc. dedans avec la position absolute, le top et le left à 0, la hauteur et la largeur à 100%. <div class="diaporama" style="position:relative;width:100%;height:0px;padding-bottom:40%;">       <iframe src="surcouf.html" frameborder="0" scrolling="no" style="position:absolute; left:0px; top:0px; width:100%; height:100%"></iframe>  </div>

Crypter une chaine de caractères en SHA512 ASP.NET à l'aide d'une clé de crytage

        using System.Text;     using System.Security.Cryptography;     public static string Hashage(string chaine, string cle)     {         Encoding encoding = Encoding.ASCII;         byte[] keyByte = PackH(cle);         HMACSHA512 hmacsha512 = new HMACSHA512(keyByte);         return ByteToString(hmacsha512.ComputeHash(encoding.GetBytes(chaine)));           }     private static byte[] PackH(string hex)     {         if ((hex.Length % 2) == 1) hex += '0';         byte[] bytes = new byte[hex.Length / 2];         for (int i = 0; i < hex.Length; i += 2)         {             bytes[i / 2] = Convert.ToByte(hex.Substring(i, 2), 16);         }         return bytes;     }     private static string ByteToString(byte[] buff)     {         string sbinary = "";         for (int i = 0; i < buff.Length; i++)         {             sbinary += buff[i].ToString("X2"); // hex format         }         return (sbinary);     }