I have to verify the pfx file and get certificate details from the web base application but its not working after hosting the page in IIS, It only work on single machine.
-First I create an exe for the fetching the details but still its not working,
(exe saves the response in one table. And we want to fetch the response in the web Application. It is working through Code But After Hosting this is not working.)
I am fetching the data through creating the batch files.
like :
Please give me any suggestion or Idea for how to get the data from exe to web application. can any one have idea please tell me.
Thanks.
Below is my code run under code but not working after Hosting.
public string GetNSDLVerify(String panno)
{
StringBuilder Script_Selparties = new StringBuilder();
Script_Selparties.AppendLine("<script language='javascript'>");
Script_Selparties.AppendLine("alert('1');");
Script_Selparties.AppendLine("</script>");
Page.ClientScript.RegisterStartupScript(this.GetType(), "", Script_Selparties.ToString());
String srcpathdCsdl = Server.MapPath("../CCRSDOCUMENTS");
String t1 = srcpathdCsdl + "/" + System.Configuration.ConfigurationManager.AppSettings["CertName"];
String t2 = System.Configuration.ConfigurationManager.AppSettings["CertPswd"];
X509Certificate2 x = new X509Certificate2(t1, t2);
System.Text.ASCIIEncoding encodingc = new System.Text.ASCIIEncoding();
string dataReg;
dataReg = System.Configuration.ConfigurationManager.AppSettings["RegisteredID"] + "^" + panno;
byte[] bytes = encodingc.GetBytes(dataReg);
ContentInfo content = new ContentInfo(bytes);
SignedCms signedCms = new SignedCms(content, false);
CmsSigner signer = new CmsSigner(SubjectIdentifierType.IssuerAndSerialNumber, x);
signedCms.ComputeSignature(signer, false);
byte[] sig = signedCms.Encode();
String sigi = Convert.ToBase64String(sig);
System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
StringBuilder postData = new StringBuilder();
postData.Append("data=" + dataReg);
postData.Append("&signature=" + System.Web.HttpUtility.UrlEncode(sigi));
byte[] data = encodingc.GetBytes(postData.ToString());
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("https://59.163.46.2/TIN/PanInquiryBackEnd");
myRequest.Method = "POST";
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.ContentLength = data.Length;
ServicePointManager.ServerCertificateValidationCallback = new System.Net.Security.RemoteCertificateValidationCallback(AcceptAllCertifications);
Stream newStream = myRequest.GetRequestStream();
newStream.Write(data, 0, data.Length);
Console.WriteLine("Send");
HttpWebResponse WebResp = (HttpWebResponse)myRequest.GetResponse();
Stream Answer = WebResp.GetResponseStream();
StreamReader _Answer = new StreamReader(Answer);
Console.WriteLine("Received");
string Response = _Answer.ReadToEnd();
newStream.Close();
return Response;
}
IS My Code which is Working fine in Code behind but not working after Hosting.
please give me Suggestion
Regards,
Atul