Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string path = HttpContext.Current.Server.MapPath("~/b2b_pin_servis_stkr.p12");
                string virtualPath = VirtualPathUtility.ToAbsolute("~/b2b_pin_servis_stkr.p12");
                string virtualPathRelative = VirtualPathUtility.ToAppRelative("~/b2b_pin_servis_stkr.p12");
                string resolveUrl = Page.ResolveUrl("~/b2b_pin_servis_stkr.p12");

                if (File.Exists(path))
                {
                    Response.Write("postoji");
                    Response.Write(path);
                    Response.Write(virtualPath);
                    Response.Write(virtualPathRelative);
                    //string[] file = File.ReadAllLines(path);
                    //foreach (string str in file)
                        //Response.Write(str);
                    byte[] file = File.ReadAllBytes(path);
                    X509Certificate cert = new X509Certificate(file, "0328", X509KeyStorageFlags.MachineKeySet);

                    eshopUtilities.CertificateWebClient webClient = new eshopUtilities.CertificateWebClient();
                    webClient.DownloadFile("https://b2b.kimtec.rs//slike//0351617_big.jpg", Server.MapPath("~/images/"));
                }
            }
            catch (Exception ex)
            {
                Page.Response.Write(ex.Message);
            }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            try
            {
                string path                = HttpContext.Current.Server.MapPath("~/b2b_pin_servis_stkr.p12");
                string virtualPath         = VirtualPathUtility.ToAbsolute("~/b2b_pin_servis_stkr.p12");
                string virtualPathRelative = VirtualPathUtility.ToAppRelative("~/b2b_pin_servis_stkr.p12");
                string resolveUrl          = Page.ResolveUrl("~/b2b_pin_servis_stkr.p12");

                if (File.Exists(path))
                {
                    Response.Write("postoji");
                    Response.Write(path);
                    Response.Write(virtualPath);
                    Response.Write(virtualPathRelative);
                    //string[] file = File.ReadAllLines(path);
                    //foreach (string str in file)
                    //Response.Write(str);
                    byte[]          file = File.ReadAllBytes(path);
                    X509Certificate cert = new X509Certificate(file, "0328", X509KeyStorageFlags.MachineKeySet);

                    eshopUtilities.CertificateWebClient webClient = new eshopUtilities.CertificateWebClient();
                    webClient.DownloadFile("https://b2b.kimtec.rs//slike//0351617_big.jpg", Server.MapPath("~/images/"));
                }
            }
            catch (Exception ex)
            {
                Page.Response.Write(ex.Message);
            }
        }