Hi Steven,
If you put a txt file in the same virtual directory where the pfx file
locates and access it in the browser via
http://myaspserver/mydir/test.txt
can you see the content of the file? If you can, can you download it via
the following code?
WebClient web = new WebClient();
string url = "
http://myaspserver/mydir/test.txt";
byte[] b = web.DownloadData(url);
If you can from your description the following code does not work? (Please
confirm it)
WebClient web = new WebClient();
string url = "
http://myaspserver/mydir/ mykey_2008.pfx";
byte[] b = web.DownloadData(url);
Please test it and tell me the result. It can help to narrow down this
issue. BTW, does your client machine need a proxy to access network
resources? In addition please check the Firewall settings on both server
side and client side as Bruce mentioned.
Regards,
Allen Chen
Microsoft Online Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| Thread-Topic: Automatically add trusted publisher to client store
| thread-index: AclEKSJkghW7rZuGRE2zq6l2ncbgow==
| X-WBNR-Posting-Host: 207.46.193.207
| From: =?Utf-8?B?U3RldmVuIFRhbmc=?= <
[email protected]>
| References: <
[email protected]>
<
[email protected]>
| Subject: RE: Automatically add trusted publisher to client store
| Date: Tue, 11 Nov 2008 10:13:01 -0800
| Lines: 67
| Message-ID: <
[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.3168
| Newsgroups: microsoft.public.dotnet.framework.aspnet
| Path: TK2MSFTNGHUB02.phx.gbl
| Xref: TK2MSFTNGHUB02.phx.gbl
microsoft.public.dotnet.framework.aspnet:79668
| NNTP-Posting-Host: tk2msftibfm01.phx.gbl 10.40.244.149
| X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
|
| Thank you for response, actually this piece of code suppose to run @
client
| computer and I'm trying to install the trust certification to the client
| computer
| who visit our aspx page which contains this piece of this code.
|
| Best Regards
|
| =======================
| Steven Tang
| SYWWUYU)
| **
|
|
| "bruce barker" wrote:
|
| > where is this code running? if its in the codebehind, then the server
is
| > downloading a cert from itself, and trying to install it to itself. if
this
| > is what you are trying to do, then try localhost, so thats it a
loopback, as
| > it common to have outgoing port 80 blocked on a webserver.
| >
| >
| > -- bruce (sqlwork.com)
| >
| >
| > "Steven Tang" wrote:
| >
| > >
| > > I want to download pfx from my asp.net server, add the pfx to
client's
| > > X509Store as
| > > a trusted publisher, Is it possible? my func in aspx is like this:
| > >
| > > void InstallCertification()
| > > {
| > > try{
| > > WebClient web = new WebClient();
| > > string url = "http:/myaspserver/mydir/mykey_2008.pfx";
| > > byte [] b = web.DownloadData(url);
| > > X509Certificate2 cert = new X509Certificate2(b, "password");
| > > X509Store store = new X509Store(StoreName.AuthRoot,
| > > StoreLocation.LocalMachine);
| > > store.Open(OpenFlags.ReadWrite);
| > > store.Add(cert);
| > > store.Close();
| > > store = new X509Store(StoreName.TrustedPublisher,
| > > StoreLocation.LocalMachine);
| > > store.Open(OpenFlags.ReadWrite);
| > > store.Add(cert);
| > > store.Close();
| > > msg.Text = "Certification installed";
| > > }
| > > catch(Exception e)
| > > {
| > > //MessageBox( e.ToString());
| > > msg.Text = e.ToString();
| > > }
| > >
| > > but the page will load pretty much longer time and show the error of
| > > System.net.webexception that unable to connect to remote server
| > > (Actually myaspserver is working, the aspx and the pfx url is
correct).
| > >
| > > Best Regards
| > > Steven
| > > --
| > > =======================
| > > Steven Tang
| > > SYWWUYU)
| > > **
|