Geeks With Blogs
Sharvan Dhaka blog
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 ......

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()); ......

//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); ......

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... ......

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 ......

The following code shows to how to perform a case-sensitive search in .NET using XPath. and contains is used as like operator in xpath. XML File: <?xml version="1.0" encoding="utf-8"?><US... <USER> <NAME>sharvan</NAM... <PASSWORD>dhaka</P... </USER></USERS>... File:<%@ Import Namespace="System.Data" ......

Using xpath you can find elements in a xml file.There is more to XML then just a way of describing data. Over the years, a number of XML-based standards have emerged. Among the most fundamental ones are XSD (XML Schema Definition), XPath Query, XSLT (Extensible Stylesheet Language Transformation), SOAP (Simple Object Access Protocol), and WSDL (Web ......

XPath is a language for finding information in an XML document. XPath is used to navigate through elements and attributes in an XML document. What is XPath? XPath is a syntax for defining parts of an XML document XPath uses path expressions to navigate in XML documents XPath contains a library of standard functions XPath is a major element in XSLT XPath ......

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 ......

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 ......

To retrive all imformation from avtive directory through ldap protocol using objX509Cert = System.Security.Cryptograph... string filter = "mail=*"; xd = lcl.LDAPInfo(filter); public XmlDocument LDAPInfo(string filter) { XmlDocument xd = new XmlDocument(); string domainAndUsername = string.Empty; string userName = string.Empty; string ......

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 ......

To do this, execute the following command on every table exec sp_changeobjectowner '?????', 'DBO' - where ????? is the name of your database table. Also below is the stored procedure through which you can change the owner for every table in the database. EXEC sp_changeobjectowner @oldownerplusobject, @new create procedure _ChangeObjectOwner (@type varchar(1),@old ......

To do this, execute the following command on every table exec sp_changeobjectowner '?????', 'DBO' - where ????? is the name of your database table. Also below is the stored procedure through which you can change the owner for every table in the database. EXEC sp_changeobjectowner @oldownerplusobject, @new create procedure _ChangeObjectOwner (@type varchar(1),@old ......

Here is a nice tips to clear the Recent project list or File list from Visual Studio .Net
Run--> RegEdit and navigate to

HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\\ProjectMRUList delete unnecessary list.

similarly for FileMRuList.

Make sure not disturb other key from the registry.


Copyright © Sharvan Dhaka | Powered by: GeeksWithBlogs.net