can any one explain when and how we can use https and ssL IN c# .net..what is the use for it?

You use https:// in C# whenever you are accessing an https:// website. I don't really know of another way to answer that question. SSL is handled under the hood for the most part by the framework so you don't have to worry about it.

Here is an example of an https:// post to an online merchant:

public void Post()
    {
      string args = GetPostUrlArgs();
      string result = string.Empty;

      HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create(@"https://secure.authorize.net/gateway/transact.dll");
      objRequest.Method = "POST";
      objRequest.ContentLength = args.Length;
      objRequest.ContentType = "application/x-www-form-urlencoded";

      StreamWriter myWriter = null;
      try
      {
        myWriter = new StreamWriter(objRequest.GetRequestStream());
        myWriter.Write(args);
      }
      finally
      {
        myWriter.Close();
        myWriter.Dispose();
      }

      HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
      using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
      {
        result = sr.ReadToEnd();
        sr.Close();
        sr.Dispose();
      }

      this.Response = new CcTxResponse(result);
    }

There is nothing to do with https and SSL. in C#. All these are server side stuffs. If any domain is installed with SSL certification then that domain can be accessed by https. You need to have dedicated IP address for that website and that website needs to have SSL certificate installed within the IIS.

commented: Wrong. SSL is both client and server side. Stop burning up the forum with useless posts, you have 5 so far this morning. +0

There is nothing to do with https and SSL. in C#. All these are server side stuffs. If any domain is installed with SSL certification then that domain can be accessed by https. You need to have dedicated IP address for that website and that website needs to have SSL certificate installed within the IIS.

Please stop burning up the forum with useless posts, and in this case incorrect information. SSL extends beyond https. SSL/Secure Socket Layer allows you to create a secure socket between any two endpoints and https:// being one implementation of it.

C# Has plenty of types related to SSL:
System.Security.Cryptography.X509Certificates
System.Net.Security.SslStream

There are more, take a look at the help file.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.