public static bool IsBase64String(string s)
{
if ((s.Length % 4) != 0)
{
return false;
}
try
{
MemoryStream stream = new MemoryStream(Convert.FromBase64String(s));
return true;
}
catch
{
return false;
}
}
keys: c#, base64, crypto,
public static bool IsBase64String(string s)
{
if ((s.Length % 4) != 0)
{
return false;
}
try
{
MemoryStream stream = new MemoryStream(Convert.FromBase64String(s));
return true;
}
catch
{
return false;
}
}
public string AssemblyGuidString(System.Reflection.Assembly assembly)
{
object[] objects =
assembly.GetCustomAttributes(typeof(System.Runtime.InteropServices.GuidAttribute), false);
if (objects.Length > 0)
{
return ((System.Runtime.InteropServices.GuidAttribute)objects[0]).Value;
}
else
{
return String.Empty;
}
}
delegate void updateLabelTextDelegate(string newText);
private void updateLabelText(string newText)
{
if (label1.InvokeRequired)
{
// this is worker thread
updateLabelTextDelegate del = new updateLabelTextDelegate(updateLabelText);
label1.Invoke(del, new object[] { newText });
}
else
{
// this is UI thread
label1.Text = newText;
}
}
Keys: asp.net, webrequest, proxy.
<system.net>
<defaultproxy>
<proxy
usesystemdefault="false"
proxyaddress="http://192.168.1.1:3128"
bypassonlocal="true"
</proxy>
</defaultproxy>
</system.net>