????? ??????? ???? ??? ???????? ????? ???? ???????? ?? ????? ??? ASP.NET

?????? ????????? ?????? ?????????
???? ???????: 901183 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

??????

?????? ??? ??????? ????? ????? ????? ???? ??? ???? ??? ???????? ?? ????? ??? ASP.NET.

?????? ????? ??????? ??????? ?? ??? ??????? ???? ??? ??? ????? ????? ??? HTTP ????? ???????? HttpWebRequest ????? ??? ?? ???? ???????? ???? ???.

????? ???

??????? ?? ??? ?????? ????? ??? ????????? ???? ?????? ????? ???. ??? ????? ????? ??? ???????? ???????? ????????? ????? ??? ?? ????? ?????????. ??? ?? ????? ?????? ????????? ???????? ???? ??? ?????? ??? ????? ??????.

????? ????? ????? ??? ASP.NET ???????? ???? ??? ???? ?????? ?????? ???????? ?? ????? ????? ??? "???? ?????". ??? ???? ???? ????? ?? ????? ????? Microsoft Windows ???????? ??? ???? ???? ?? ????? ??? ?????.

???? ??? ?????? ??? ????? ????????? ????? ????? ???????? ??????:
  • ???? ?????? ??????: ????? ????? ??? ASP.NET ?? ??? ?????? ????? ???? ???? ????????.
  • ???? ???????? ??????: ????? ?? ??? ?????? ?????? ???? ?????? ????? ?????? ?????? ????????.
????? ??? ????? ?????? ?????? ????? ????? ???? ??? ????? ????? ?????? ?? ???? ???????? ??????. ????? ???? ????? ?????? ???????? ???????? ??????. ??? ???? ?? ???? ????? ?????? ????? ??? ASP.NET ?????????.

??????? ????

?????? ????? ??? ASP.NET ???????? ?????? ???????? ??? ????? ????? ?????? ?? ???? ?????? ??????. ??? ????? ????? ???? ?? ???? ?????? ?????? ????? ?????? ????? ??? ??????? ?????????? ?? ?????? ????????? ?????? ????? ?????? ????? ?????? ????????. ????? ??? ??? ?? ?????? ??? ????? ?????? ????? ???????? ???? ??? ???????? ?????? ????? ??? ASP.NET.

?????? ??? ?? ???? ???? Microsoft.NET Framework 1.1 Service Pack 1 (SP1) ????? ???????? ?????? ?????? ?? ???? ?????? ??????.

???????? ??? ???? ??? ASP.NET ????? ??? ???????? ???? ???? ??? ????? ??????? ????? ????? ?????? ?? ??????? ?? ?? ?????? ???? ????? ???????? ???? ???.

????? ????? ?????? ???? ?? ?????? ????? ????????

?????? ????? ??????? ???? ?? ?????? ?????? ?????? ????? ???????? ???? ??? ???????? ?????? ????? ??? ASP.NET? ???? ??????? ???????.

?????? 1: ????? ????? ?????? ?? ???? ?????? ??????

??? ??? ???? ????? ???? ?? ??? PKCS #12 (.pfx)? ????? ??????? "???? ????? Microsoft Windows HTTP ????? ???????" (WinHttpCertCfg.exe) ?????? ????? ?????? ???? ?? ?????? ??? ????? ?????? ??????? ?????? ???????? ??? ???? "???? ??????". ?????? ????? ???? ??? ??????? ???????:
  1. ?? ?????? ?? ?? ?????? Microsoft Windows HTTP ???? ????? ????? ????????. ?????? ??? ??????? ?????? ???? Microsoft ??? ?????:
    http://www.microsoft.com/downloads/details.aspx?familyid=c42e27ac-3409-40e9-8667-c748e422833f
  2. ?? ?????? ????? ?????? ?? ???? ???????:
    ?????????????-i PFXFile -c LOCAL_MACHINE\My-a IWAM_TESTMACHINE-p ??????????
    ??????PfxFile ?? ??? ???.pfx. ???? ?????? ??? ???? ?????? ???? &.pfx. ??? ??? ????? ?? ????? ???? ????? ??? ??????? -p .

    ????? ??? ??? ????? WinHttpCertCfg.exe ?? ?? ??? ??????:
    Kits\Tools ??????? ?????? C:\Program
??? ??? ??? ???? ?? ?????? ??? ???.pfx? ????? ????? ????? Microsoft ??????? ??? ??????? ???? ???? ?????? Microsoft Windows Server 2003 ?? Microsoft Windows 2000 Server? ????? ??? ?????? ????? ?????? ?????? ?? ???? ?????? ??????. ?????? ????? ???? ??????? ???????:
  1. ????? ?????? ??? ????????? ?????? ???????? ???? ?????? ????? ??? ?????? ?????? ???????.
  2. ?? Microsoft Internet Explorer? ?? ?????? ?????? ?????? (CA) ???? ???. ??? ???? ??????? ??? ??? ?????? CA ???? ????????? ?? ?????? ???? ?????? ??? ?????:
    http://CAServer/certsrv
  3. ??? ??? ????? ???? ??? ??? ?????? ?? ???? ??? ????? ??? ???????.
  4. ???? ??? ????? ?????? ??? ??? ??? ?????? ??????.
  5. ?? ??? ????? ????????????? ???? ??? ?????? ?????? ????????.
  6. ?? ??? ??????? ????????? ???? ??? ????? ?????? ??????.
  7. ?? ?????? ??????? ??????? ???? ??? ??? ??? ????? ??????? ?? ????? ????????? ?????? ???? ???? ???????? ??? ?? ???? ??? ?????.

    ?????? ???? ??? ?????? ??????.
  8. ?? ?????? ?????? ??????????? ??????? ???? ??? "???".
  9. ??? ???? ?????? ?????? ????? ??????? ???? ??? ?????? ????????? ?? ???? ??? ??? ???? ??? ????? ????.
  10. ??? ??? ??? ??????? ???? ?????? ????? ???? ??? ??? ??????? ???? ??????? ?? ?????? 7.
  11. ???? ??? ????? ??? ???????? ? ?? ???? ??? "???" ?? ?????? ?????? ??????? ???? ??????.

???? 2: ????? ?????? ??? ????? ??????

?? ??? ??????? ??? ??? ??? ????? ASP.NET ??? ?????? ??? ????? ?????? ???? ?? ??????? ?? ???? ?????? ??????. ????????? ?? ???? "???? ??????" ???? ?????? ??????? ??? ?? Windows Server 2003. ????? ??? ??? ?????? ??? ????? ???? "???? ??????". ??? ??? ???? ????? ???? ???? ?????? ASP.NET? ??? ??? ?? ?????? ??????? ????.

?????? ?? Microsoft Internet ??????? Server (IIS) 5.0? ??? ????? ASP.NET ??? ASPNET ???? ??? ???? "???? ???? ???????". ????? ??? ??? ???????? ?????? ????? ASPNET ??? ???? ??????? ???? ?????? IIS 5.0.

???? ?? ?????? ????? ?????? ????? ?? ?????? ??????? ????? ?? ???? ???????:
WinHttpCertCfg.exe--c LOCAL_MACHINE\MY ???? "????????????" -a "??? ??????"
????????? ?????? ?? ??? ???? ??????? ???? ?? ???? ????. ???????????? ?? ??? ?????? ?? ?????? ???? ????? ?????? ?? ?????. ??? ????? ????? ??? ????? ??? ????? ????? ??????. ???? ????? ????? ?? ????? ??????? ???? ?? ??????? ????? ??? ??? ????? ???? ????? ??? ???????.

??? ??? ??????? ?????? ???? ?? ????? ??? ?? ?????? ??? ????? ???? ????? "???? ???? ???????" ?? Microsoft Internet ??????? Services (IIS) 6.0:
WinHttpCertCfg.exe--c LOCAL_MACHINE\MY ???? "????????????"-a" NetworkService "
??? ??? ??????? ?????? ???? ?? ????? ??? ?? ?????? ??? ????? ?????? ????? ASPNET ?? IIS 5.0:
WinHttpCertCfg.exe--c LOCAL_MACHINE\MY ???? "????????????"-a" ASPNET "
?????? ??? ??????? Windows HTTP ???? ????? ????? ????????? ????? ?? ????? ??????? ????? ?????? ? ????? ????? ?????? ??? ????? ?????? ?? ???? ?????. ?? ??? ??? ???? ??????? ??? ??? ??????? ?????? ?????? ?????????:
Winhttpcertcfg.exe-i PFXFile -c LOCAL_MACHINE\My-a "??? ???????

?????? 3: ??? ????? ?????? ?? ???? ???????? ?????? ??? ???? ?????? ??????

??? ??? ??? ????????? ????????? ??? ????? Windows Forms ?? ??? ??????? ???? ?????? ??? ????? ????? ??????? ?????? ??? ????? ??????? ?????? ?? ???? ???????? ??????. ??? ???? ??? ???? ???? ???? ????? ??? ??????? ?????? ??? ASP.NET ?????? ????? ?????? ???? ?? ?? ???? ????? ?????? ????? ?? ???? ?????? ??????.

??? ?????? ???? ??? ??????? ????? ??? ????? ?????? ?? ???? ???????? ?????? ??? ???? ?????? ?????? ???????? "????? ????? ????????".

?????? ??? ???? ????? ?????? ?????? ?? ???? ?????? ?????? ?? ??? ??? ????? ????? ????? ?????? ?? ???? ?????? ?????? ??? ?? ?????? ?????? 1? ????? ??? "?????? ???????". ??? ???? ??? ??? ?????? ?????? 3? ??? ???? ?? ?????? ??? ?????? 2 ??? ??? ?? ?????? ??? ????? ??????.

???? ????? ?????? ??? ?????? ???? ??????? ???? ??????? ???????:
  1. ???? ??? ??? ?????? ???? ??? ?????? ??? mmc? ?? ???? ??? ?????.
  2. ??? ??? ???????? ???? ??? ?????/????? ???? ??????? ?? ???? ??? ?????.
  3. ?? ????? ??????? ???????? ???????? ???? ? ???? ??? ????????? ???? ??? ?????? ???? ??? ???? ?????????? ???? ??? ??????? ?? ???? ??? "?????".
  4. ?? ????? ??????? ???????? ???????? ???? ? ???? ??? ????????? ???? ??? ?????? ???? ??? ???? ???????? ????? ??? ?? ???? ??? "?????".
  5. ???? ??? ?????? ?? ???? ??? ?????.
  6. ?????? ????? ?????? ?? ???? ???????? ??????? ???? ??????? ???????:
    1. ?? ?????? ????????-???????? ??????, ?? ?????? ???????? ?? ???? ??? ????????.
    2. ?? ?????? ?????? ??? ????? ??????? ???? ??? ???? ??????? ???? ??? ?????? ?? ???? ??? ??????.
    3. ??? ??? ???? ????? ??????? ????? ?????? ?? ??? ?????? ????? ??? ASP.NET ?? ???? ??????? ????? ??????. ??? ?????? ??? ????? ???? ???. ?????? ????? ???? ????????? ?? ???????? 1 ? 2. ????? ???? ??? ???? ????? ??????? ?????? ?? ???? ??? ?????? ????? ???????.
    4. ?? ???? ?????? ???? ??? ????? ???? ?????? ? ???? ???? ???? ?? ???? ??? ??????.
    5. ?? ??? ????? ? ???? ??? ???. ???? ??? ??????? ?? ???? ??? "?????".
    6. ?? ????? ????? ???????????? ??????? ???? ??? ?????.
  7. ???????? ????? ?????? ??? ???? ?????? ??????? ???? ??????? ???????:
    1. ?? ?????? ???????? (????????? ??????), ?? ?? ?????? ???????.
    2. ???? ????? ?????? ????????? ???? ??? ???? ??????? ???? ??? ?????????? ?? ???? ??? ??????.
    3. ?? ??? ????? ? ???? ????? ????? ???? ?????? ?? ?????? 6e? ?? ???? ??? ??????.
    4. ?? ???? ?????? ? ???? ???? ?????? ?????? ?? ?????? 6 d? ??? ???? ??? ?????? ????? ???????.
    5. ???? ??? "?????"? ?? ???? ??? ?????.

?????? 4: ????? ????? ?????? ?????? ?????

??? ?? ?????? ????? ?????? ?????? ????? ?????? ???? ???? ??? VeriSign? ?? ??? ??? ???? ?????? ????? ????? ????? ?????? ??????? ????? ??? ?????? 4.

???? ???????? ????? Windows ??? ???????? ??????? ???????? ?????? ??????? ??????? ?????? ????? ?????? ?? "??? ????? ??" ???? ????????.
???? ?? ????? ??????? ?????
?????? ?? ?? ????? ?? ????? ????? ?????? ??????? ???? ??? ??????? ???????:
  1. ???? ??? ??? ?????? ???? ??? ?????? ??? mmc? ?? ???? ??? ?????.
  2. ??? ??? ???????? ???? ??? ?????/????? ???? ??????? ?? ???? ??? ?????.
  3. ?? ????? ??????? ???????? ???????? ???? ? ???? ??? ????????? ???? ??? ?????? ???? ??? ???? ?????????? ???? ??? ??????? ?? ???? ??? "?????".
  4. ???? ??? ?????? ?? ???? ??? ?????.
  5. ?? ?????? ???????? (????????? ??????), ?? ?????? ??????? ??????? ????? ????????? ?? ???? ??? ????????.
  6. ?? ????? ??????? ???? ?? ?? ??????? ????? CA ???? ???? ???????? ???????.
????? ??????? ?????
??? ?? ??? ??????? ????? CA ???? ???? ???????? ???? ??? ????? ????? ?????. ??? ??????? ????? CA ???? ???? ???????? ??? ?? ?? ??? ????? ??? ???.cer ?? ???.der ???.pfx? ???? ??????? ???????:
  1. ?? ?????? ???????? (????????? ??????), ???? ????? ?????? ??????? ??????? ????? ????????? ???? ??? ???? ??????? ?? ???? ??? ?????????.
  2. ?? ????? ??????? ???????????? ??????? ???? ??? ??????? ?? ?? ??? ??? ????? ???? ??? ??? ???????? ??? ???? ??? ?????? ?????.
  3. ???? ??? "?????"? ?? ???? ??? ?????.
??? ??????? ?????
??? ?? ????? CA ???? ???? ???????? ?? ????? ?????? ????? ????? ????? Microsoft? ????? ??? ??????? ?????. ?????? ????? ???? ??????? ???????:
  1. ?? Internet Explorer? ?? ?????? ???? ???. ??? ???? ??????? ??? ??? ?????? CA ???? ????????? ?? ?????? ???? ?????? ??? ?????:
    http://CAServer/certsrv
  2. ???? ??? ????? ?????? ???? ???????? ????? ?????? ?? CRL? ?? ???? ??? ????? ?????? ?????? ?????.
  3. ?? ????? ??? ???? ??????? ???? ??? ???.
  4. ?? ??? ???? ??????? ???? ?????? ??? ???? ??? ??? ???????? ?? ???? ??? ???.
  5. ??? ?? ??? ???? ??? ??????? ?????? ??????? ??????? ?? ????? "????? ????? ?????" ?????? ??? ??????? ?? ????? ?? ???? "??????? ??????? ?????".

??????? ???? ???

??? ???????? ?? ????? ????? ?????? ?? ?? ???? ?????? ?????? ?? ??? ???? ???????? ??????? ????? ?????? ??? ????? ?????? ?? ????? ??? ASP.NET ???????? ???? ???. ??????? ??????? ?????? ??? ????? ?????? ?? ????? ?????? Windows Forms ?? ??? ? ASP.NET ???????.

??? ??? ?????? "??????.NET framework"? ??? ????? ????? ??????? ??? ??? ?? ????? DER. ??? ???? ????? ??????? ????? System.Security.Cryptography.X509Certificates.X509Certificate ?? ????? ?????? ??? ?????? ?????? ??? ?????? ??????? ?? ???? ??????. ????? ??? ????? ??????? ?????? ????? ?? ??? ?? ????? DER.

?????? ???? ??????? ????? ??? 2.0 ? Microsoft.NET (WSE) ????? ???? ??????? ???????? ?????? ????? ?????? ?? ???? ??????.

?????? C# ?????? ??????? ?????? ???? ????? ??????? ???? ??? ?????? ????? ???? ????????.
using System.Security.Cryptography.X509Certificates;
...

  public void CallWebService()
  {
    // TODO: Replace <C:\WSClientCert.cer> with the path of your certificate file.
    string certPath = @"<C:\WSClientCert.cer>";

    // Create an instance of the Web service proxy.
    WebSvc.math mathservice = new WebSvc.math();
    // TODO: Replace <https://wsserver/securemath/math.asmx> with a valid URL.
    mathservice.Url = @"<https://wsserver/securemath/math.asmx>";

    // Create an X509Certificate object from the information 
    // in the certificate export file, and then add the certificate to the 
    // ClientCertificates collection of the Web service proxy.
    mathservice.ClientCertificates.Add(
        X509Certificate.CreateFromCertFile(certPath));

    long lngResult = 0;
    try
    {
      lngResult = mathservice.Add(Int32.Parse(operand1.Text), 
          Int32.Parse(operand2.Text));
      string result = lngResult.ToString();
    }
    catch(Exception ex)
    {
      if(ex is WebException)
      {
        WebException we = ex as WebException;
        WebResponse webResponse = we.Response;
        throw new Exception("Exception calling method. " + ex.Message);
      }
    }
  }

??????? 2.0 ? Microsoft.NET ????? ???

??????? ????? ??? 2.0 ? Microsoft.NET (WSE) ?? Microsoft.NET ????? ?????? ????? ????? ??? ???????? ????? ??? ???? ????????????. ????? ??? ???????????? ???????:
  • WS-??????
  • ???????????????? WS
  • ??? WS
  • ??? WS
  • WS SecurityPolicy
  • ????? WS
  • ?????? WS
?????? ?? ??? ??????? ???? ??.NET Framework WSE. ?????? ??? WSE? ?? ?????? ???? Microsoft ?????? ??? ?????:
http://www.microsoft.com/downloads/details.aspx?FamilyId=FC5F06C5-821F-41D3-A4FE-6C7B56423841
??? ???? ???????? ?? ?? ??? ???????????? ?????? ??? ???? ??? ???? ????? ?????? ????? ??????. ??? ???? ?? ????? ??? ??????? ??? Microsoft.Web.Services2.Security.X509 . ????? ??? ????? Microsoft.Web.Services2.Security.X509 ?????? ??? ?????? ?????? ??? ????? ???? ?? ???? ????????. ??? ??? ?????? ??? ?????? ?? ??? ??????? ??????? ??? ???.

????? C# ?????? ?????? ??????? ?????? ???? ????? ?????? ??? ????? ????? ???? ?????????????? ?? ???? ?????? ??????. ??? ?????? ??? ?????? ??????? ?????? ??????? ??????? ????? ????? ????????? ???? ???. ????????? ???? ??? ????? ?????? ??????.
...
  // TODO: Replace <SecureMathClient> with the name of the client certificate.
  string certName = "<SecureMathClient>";

  // WSE 2.0 method
  X509CertificateStore store =
    X509CertificateStore.LocalMachineStore(X509CertificateStore.MyStore);
  store.OpenRead();
  // Look for the first certificate that is named SecureMathClient.
  // Look in the local machine store.
  X509CertificateCollection col= 
    (X509CertificateCollection)store.FindCertificateBySubjectString(certName);
  X509Certificate cert =null;
  try
  { 

// This sample obtains the first matching certificate from the collection.
    cert = col[0];
  } 
  catch(Exception ex)
  {
    throw new Exception("Certificate not Found!");
  }

  // Create an instance of the Web service proxy.
  math mathservice = new math();
  // TODO: Replace <https://wsserver/securemath/math.asmx> with a valid URL.
  mathservice.Url = @"<https://wsserver/securemath/math.asmx>";
  mathservice.ClientCertificates.Add(cert);

  long lngResult = 0;
  try
  {
    lngResult = mathservice.Add(Int32.Parse(operand1.Text), 
        Int32.Parse(operand2.Text));
    result.Text = lngResult.ToString();
  }
  catch(Exception ex)
  {
    if(ex is WebException)
    {
      WebException we = ex as WebException;
      WebResponse webResponse = we.Response;
      throw new Exception("Exception calling method. " + ex.Message);
    }
  }

?????

????? ?? ????????? ??? ??? System.Security.Cryptography.X509Certificates.X509Certificate ? ?? ?????? ??? ???? ????? Microsoft (MSDN) ?????? ??????:
.aspx http://msdn2.microsoft.com/en-us/library/system.security.cryptography.x509certificates.x509certificate (vs.71)
????? ?? ????????? ??? ????? ??????? ????? ??? ????? ?????? ???????? ????? ??? ASP.NET? ???? ??? ??? ??????? ?????? ?????? ?? "????? ??????? ? Microsoft":
817854?????: ????? ??? ASP.NET ????? ????? ????? ???? ??? ???? ??? ????? ??????

???????

???? ???????: 901183 - ????? ??? ??????: 09/????? ??????/1434 - ??????: 5.0
????? ???
  • Microsoft .NET Framework 1.1, ????? ?????? ??:
    • Microsoft Internet Information Services 6.0
    • Microsoft Internet Information Services 5.0
????? ??????: 
kbcode kbwebservices kbcertservices kbhowto kbinfo kbmt KB901183 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????901183

????? ???????

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com