if (System.IO.File.Exists(Server.MapPath(@PathName)))
{
FileStream fs1 = new FileStream(Server.MapPath(@PathName), FileMode.Open, System.IO.FileAccess.Read);
BinaryReader br1 = new BinaryReader(fs1);
byte[] imgbyte1 = new byte[fs1.Length + 1];
imgbyte1 = br1.ReadBytes(Convert.ToInt32((fs1.Length)));
byte[] imgbyte = new byte[2000];
string a = "";
Webservices objUTR = new Webservices();
objUTR.UploadTransaction("UserID", "Password", imgbyte1, lblXmlFileName.Text, out a, out imgbyte);
if (imgbyte != null)
{
string s1 = Encoding.UTF8.GetString(imgbyte);
string Ss = ASCIIEncoding.ASCII.GetString(imgbyte);
StringBuilder hex = new StringBuilder(imgbyte.Length * 2);
foreach (int b in imgbyte)
hex.AppendFormat("{0:x2}", b);
string s2= hex.ToString();
string sGenName = "SubmissionError";
using (System.IO.StreamWriter SW = new System.IO.StreamWriter(
Server.MapPath("~/" + "Eclaim_XMLError" + "/" + sGenName)))
{
SW.WriteLine(s1);
SW.Close();
}
System.IO.FileStream fs = null;
fs = System.IO.File.Open(Server.MapPath("~/" + "Eclaim_XMLError" + "/" +
sGenName + ".txt"), System.IO.FileMode.Open);
byte[] btFile = new byte[fs.Length];
fs.Read(btFile, 0, Convert.ToInt32(fs.Length));
fs.Close();
Response.AddHeader("Content-disposition", "attachment; filename=" + sGenName);
Response.ContentType = "application/octet-stream";
Response.BinaryWrite(btFile);
Response.End();
}
if (a != null)
{
lblShowMsg.Visible = true;
lblShowMsg.Text = a;
if (a == "Operation is successful")
{
lblShowMsg.Visible = true;
lblShowMsg.Text = "Operation is successful";
}
}
}
{
FileStream fs1 = new FileStream(Server.MapPath(@PathName), FileMode.Open, System.IO.FileAccess.Read);
BinaryReader br1 = new BinaryReader(fs1);
byte[] imgbyte1 = new byte[fs1.Length + 1];
imgbyte1 = br1.ReadBytes(Convert.ToInt32((fs1.Length)));
byte[] imgbyte = new byte[2000];
string a = "";
Webservices objUTR = new Webservices();
objUTR.UploadTransaction("UserID", "Password", imgbyte1, lblXmlFileName.Text, out a, out imgbyte);
if (imgbyte != null)
{
string s1 = Encoding.UTF8.GetString(imgbyte);
string Ss = ASCIIEncoding.ASCII.GetString(imgbyte);
StringBuilder hex = new StringBuilder(imgbyte.Length * 2);
foreach (int b in imgbyte)
hex.AppendFormat("{0:x2}", b);
string s2= hex.ToString();
string sGenName = "SubmissionError";
using (System.IO.StreamWriter SW = new System.IO.StreamWriter(
Server.MapPath("~/" + "Eclaim_XMLError" + "/" + sGenName)))
{
SW.WriteLine(s1);
SW.Close();
}
System.IO.FileStream fs = null;
fs = System.IO.File.Open(Server.MapPath("~/" + "Eclaim_XMLError" + "/" +
sGenName + ".txt"), System.IO.FileMode.Open);
byte[] btFile = new byte[fs.Length];
fs.Read(btFile, 0, Convert.ToInt32(fs.Length));
fs.Close();
Response.AddHeader("Content-disposition", "attachment; filename=" + sGenName);
Response.ContentType = "application/octet-stream";
Response.BinaryWrite(btFile);
Response.End();
}
if (a != null)
{
lblShowMsg.Visible = true;
lblShowMsg.Text = a;
if (a == "Operation is successful")
{
lblShowMsg.Visible = true;
lblShowMsg.Text = "Operation is successful";
}
}
}
No comments:
Post a Comment