Geeks With Blogs
Sharvan Dhaka blog Asp.net
X509Chain Class
Namespace: System.Security.Cryptograph... System (in system.dll) The X509Chain object has a global error status called ChainStatus that should be used for certificate validation. The rules governing certificate validation are complex, and it is easy to oversimplify the validation logic by ignoring the error status of one or more of the elements involved. The global error status takes into consideration the status of each element in the chain.The following code example opens ......

Posted On Sunday, October 15, 2006 6:18 PM

Digital Certification X509Certificate C# Asp.net
Any application of cryptography in building a secured infrastructure uses many of encryption, hashing and signature ciphers. In fact all the cryptographic solutions that are available today include a comprehensive infrastructure with many ciphers, extensive security policies, rich tools for creating, deploying and managing secure applications and other integrated set of cryptographic services. One such infrastructure that comes with Windows 2000 is Public Key Infrastructure (PKI). The challenge for ......

Posted On Sunday, October 15, 2006 6:12 PM

Read Response of a web request in a byte Array with C# Asp.net
this code snippet read the respone fo a web request through binary reader private byte[] getByte(string URL) { HttpWebRequest wrGETURL = (HttpWebRequest)WebRequest.... System.Net.HttpWebResponse webresponse = (HttpWebResponse)wrGETURL.G... string ct = webresponse.ContentType; Stream objStream = webresponse.GetResponseStre... BinaryReader breader = new BinaryReader(objStream); byte[] buffer = breader .ReadBytes((int)webresponse... return buffer; } ......

Posted On Sunday, October 15, 2006 5:57 PM

Force a page to download a file c# asp.net
string Id= "0"; try { this.EnableViewState = false; Response.ContentType = "text/.txt"; string Filename = System.Web.HttpContext.Curr... Filename = Filename + Id + ".txt"; Response.WriteFile(Filename); // Response.Write("string"); string strFilename = Id + ".txt"; Response.Buffer = true; Response.AddHeader("Content... "attachment; filename=" + ID+".txt"); } catch (Exception ex) { Response.Write(ex.ToString()); } Response.End(); ......

Posted On Sunday, October 15, 2006 5:56 PM

Create .VCF File(outlook contact file) with C#
This is code of to create vcf card on the fly //sdBuild is string builder sdBuild.Append("N:" + strCn + System.Environment.NewLine); sdBuild.Append("FN:" + strCn +System.Environment.NewLine); //// encoding to base 64 certString64 = certString64 + System.Environment.NewLine + "KEY;X509;ENCODING=BASE64:" + System.Environment.NewLine; certString64 = certString64 + Convert.ToBase64String((byt... + System.Environment.NewLine; //// encoding to base 64 ends here sdBuild.Append(certString64); sdBuild.Append(System.Envir... ......

Posted On Sunday, October 15, 2006 5:55 PM

How to get the HTML name attribute of ASP.Net Control c# as.net
//Function to get the HTML name of the server control from the Client Id // Parameters: // clientId - Control.ClientId // serverId - Control.id private string GetHTMLNameById(string clientId, string serverId) { int pos = serverId.IndexOf('_'); string HTMLName = ""; if(pos >= 0) { pos = clientId.IndexOf(serverId); HTMLName = clientId.Remove(pos, serverId.Length); HTMLName = HTMLName.Replace('_', '$'); HTMLName += serverId; } else HTMLName = clientId.Replace('_', '$'); return HTMLName; } ......

Posted On Sunday, October 15, 2006 5:49 PM

Serialize & Deserialize c# asp.net
Serialize (convert an object instance to an XML document): // Assuming obj is an instance of an object XmlSerializer ser = new XmlSerializer(obj.GetType()); System.Text.StringBuilder sb = new System.Text.StringBuilder(); System.IO.StringWriter writer = new System.IO.StringWriter(sb); ser.Serialize(writer, obj); XmlDocument doc = new XmlDocument(); doc.LoadXml(sb.ToString()); Deserialize (convert an XML document into an object instance): //Assuming doc is an XML document containing a serialized object ......

Posted On Sunday, October 15, 2006 5:43 PM

How to convert a string to a byte array and convert a byte array to a string c# asp.net
Convert a string to a byte array string myString = "a test string"; byte[] myByteArray = new byte[myString.Length]; int i = 0; foreach(char c in InStr.ToCharArray()) { myByteArray [i] = (byte)c; i++; } Convert a byte array to a string System.Text.Encoding enc = System.Text.Encoding.ASCII; byte[] myByteArray = enc.GetBytes("a text string); string myString = enc.GetString(myByteArray ); ......

Posted On Sunday, October 15, 2006 5:42 PM

Diff DataReader/DataAdapter
The DataReader provides forward, read-only access to the data read from the database. It provides no mechanisms for randomly accessing the data. A DataAdapter, along with a DataTable or DataSet, provides random access to data. In addition, the data can be changed in the DataTable or DataSet, and the DataAdapter can be used to update the data in the database. Of the two access methods, the DataReader is the lightest and fastest and is preferable when you need to only read the data, as reflected in ......

Posted On Sunday, October 15, 2006 5:38 PM

Preventing Multiple Logins in ASP.NET
We talked about the fact that the classic ASP Session_OnEnd handler is widely known to be pretty unreliable. However, in ASP.NET the corresponding Global class handler, Session_End, is very reliable. Then we talked about "what if" scenarios, such as what if the ASP.NET worker process was recycled? If so, I reasoned, it didn't matter whether you were using Session, Application or Cache, all of your stuff would be lost. The only exceptions to this would be if you were using the ASP.NET State Server ......

Posted On Sunday, October 15, 2006 5:36 PM

Copyright © Sharvan Dhaka | Powered by: GeeksWithBlogs.net