KeyLimeTie Blog
Nothing groundbreaking here, but if you need to know how to convert plain text to an MD5 Hash, here you go:
1using System;
2using System.Security.Cryptography;
3using System.Text;
4
5public static string ConvertToMD5(string plainText)
6{
7 byte[] input = Encoding.UTF8.GetBytes(plainText);
8 byte[] output = MD5.Create().ComputeHash(input);
9 return Convert.ToBase64String(output).Trim();
10}
/html>
File uploads do not work when doing async postbacks due to security restrictions. Because of this, we have to add a PostBackTrigger. PostbackTriggers enable controls inside an UpdatePanel to cause a postback instead of performing an asynchronous postback. Here's a code snippet that shows how to accomplish this.
<asp:Content ID="Content1" ContentPlaceHolderID="cphContent" runat="Server">
<asp:UpdatePanel ID="UpdatePanel1" runat ="server">
<Triggers>
<asp:PostBackTrigger ControlID="imgbtnUpload" />
</Triggers>
<ContentTemplate>
<asp:FileUpload ID="txtFile" runat ="server" />
<asp:ImageButton ID="imgbtnUpload" runat="server" ImageUrl="~/Common/Images/upload.gif" OnClick="imgbtnNext_Click" />
</ContentTemplate>
</ asp:UpdatePanel>
</ asp:Content>
By adding the PostbackTrigger, you can mix controls that make AJAX calls with controls that require the postback and maintain the good user experience.