public void Message_newMessage(EntityModel.Message msj) { // Agregue aquí la implementación de la operación //MessageBL.newMessage(text, idaccount); MessageBL.newMessage(msj); }
public bool Post([FromBody] Message s) { MessageBL.AddMessage(s); return(true); }
public List <EntityModel.Message> Message_getAllMessage() { // Agregue aquí la implementación de la operación return(MessageBL.getAllMessage()); }
protected void Page_Load(object sender, EventArgs e) { Boolean bResult = false; try { String strPhoneId = String.Empty; String strPhoneId1 = String.Empty; if (!String.IsNullOrEmpty(Request.QueryString["ShopID"])) { if (Request.QueryString["User_ID"] != null) { strPhoneId1 = Request.QueryString["User_ID"]; } else if (Request.Form["User_ID"] != null) { strPhoneId1 = Request.Form["User_ID"]; } if (!Int32.TryParse(Security.DecodeNumbers(Request.QueryString["ShopID"]), out iShopID)) { return; } } else { if (Request.QueryString["User_ID"] != null) { strPhoneId = Request.QueryString["User_ID"]; } else if (Request.Form["User_ID"] != null) { strPhoneId = Request.Form["User_ID"]; } } UserBL objUser = null; if (!String.IsNullOrEmpty(strPhoneId)) { //if phone user id is found objUser = UserBL.getDataByPhoneId(strPhoneId); } else { MyCustomerBL objMyCustomer = MyCustomerBL.getDataByShopIdNPhone(iShopID, strPhoneId1); if (objMyCustomer != null) { objUser = UserBL.getByActivityId(objMyCustomer.iUserId.Value); } } if (objUser != null) { String strUserName = String.Empty; if (string.IsNullOrEmpty(objUser.strUserName)) { if (Request.QueryString["Phone_Owner_Name"] != null) { objUser.strUserName = Request.QueryString["Phone_Owner_Name"]; } else if (Request.Form["Phone_Owner_Name"] != null && !string.IsNullOrEmpty(Request.Form["Phone_Owner_Name"].ToString())) { objUser.strUserName = Request.Form["Phone_Owner_Name"]; } } objUser.Save(); UserPreferredShopBL objUserPreferredShop = UserPreferredShopBL.getShopByUserId(objUser.ID); MessageBL objMessage = null; if (objUserPreferredShop != null || iShopID > 0) { objMessage = new MessageBL(); objMessage.iPhoneUserID = objUser.ID; if (objUserPreferredShop != null) { objMessage.iShopID = objUserPreferredShop.iShopId; } else { objMessage.iShopID = iShopID; } objMessage.dtMessageTime = DateTime.Now; if (Request.QueryString["Message"] != null) { objMessage.strMessage = Request.QueryString["Message"].ToString(); } else if (Request.Form["Message"] != null) { objMessage.strMessage = Request.Form["Message"].ToString(); } String strType = String.Empty; if (Request.QueryString["MessageType"] != null) { strType = Request.QueryString["MessageType"].ToString(); } else if (Request.Form["MessageType"] != null) { strType = Request.Form["MessageType"].ToString(); } String[] strPhoneNumbers = null; if (Request.QueryString["smsTo"] != null) { strPhoneNumbers = Request.QueryString["smsTo"].ToString().Split(','); } if (strType.ToLower() == "predefinedsms" && Request.QueryString["Message"] != null) { String strMSG = Request.QueryString["Message"].ToString(); if (strPhoneNumbers != null) { SMS objSMS = new SMS(); foreach (String item in strPhoneNumbers) { objSMS.SendSMS(item, objMessage.strMessage, objUser.strPhone, objUser.ID); } } } try { if (Request.QueryString["Latitude"] != null) { objMessage.fLatitude = Convert.ToDouble(Request.QueryString["Latitude"]); } else if (Request.Form["Latitude"] != null) { objMessage.fLatitude = Convert.ToDouble(Request.Form["Latitude"]); } } catch (Exception ex) { objMessage.fLatitude = 0.0; } try { if (Request.QueryString["Longitude"] != null) { objMessage.fLongitude = Convert.ToDouble(Request.QueryString["Longitude"]); } else if (Request.Form["Longitude"] != null) { objMessage.fLongitude = Convert.ToDouble(Request.Form["Longitude"]); } } catch (Exception ex) { objMessage.fLongitude = 0.0; } objMessage.iType = Constants.PredefinedSMS; objMessage.Save(); BodyShopBL objBodyShop = null; if (objUserPreferredShop != null) { objBodyShop = BodyShopBL.getShopById(Convert.ToInt32(objUserPreferredShop.iShopId)); } else { objBodyShop = BodyShopBL.getShopById(iShopID); } if (objBodyShop != null) { objBodyShop.iNoHelpSelection = (objBodyShop.iNoHelpSelection == null) ? 1 : (objBodyShop.iNoHelpSelection + 1); if (objBodyShop.Save()) { if (Cache["CommunicationList"] != null) { Cache.Remove("CommunicationList"); } if (Cache["OpportunityList"] != null) { Cache.Remove("OpportunityList"); } if (Cache["RepairProspect"] != null) { Cache.Remove("RepairProspect"); } if (Cache["EmailMarketing"] != null) { Cache.Remove("EmailMarketing"); } if (Cache["TextMarketing"] != null) { Cache.Remove("TextMarketing"); } bResult = true; } } } } } catch (Exception ex) { bResult = false; } XmlDocument xmlDoc = new XmlDocument(); MemoryStream stream = new MemoryStream(); //XmlTextWriter xmlWriter = new XmlTextWriter(stream, System.Text.Encoding.ASCII); XmlTextWriter xmlWriter = new XmlTextWriter(stream, System.Text.Encoding.UTF8); xmlWriter.WriteStartDocument(); xmlWriter.WriteStartElement("EditCountReport"); xmlWriter.WriteElementString("Status", bResult ? "Success" : "Fail"); xmlWriter.WriteEndElement(); xmlWriter.WriteEndDocument(); xmlWriter.Flush(); byte[] byteArray = stream.ToArray(); HttpContext.Current.Response.Clear(); HttpContext.Current.Response.AppendHeader("Content-Disposition", "filename=MyExportedFile.xml"); HttpContext.Current.Response.AppendHeader("Content-Length", byteArray.Length.ToString()); HttpContext.Current.Response.ContentType = "text/xml"; HttpContext.Current.Response.BinaryWrite(byteArray); }
protected void Page_Load(object sender, EventArgs e) { Boolean bResult = false; try { String strPhoneId = String.Empty; String strPhoneId1 = String.Empty; if (!String.IsNullOrEmpty(Request.QueryString["ShopID"])) { if (Request.QueryString["User_ID"] != null) { strPhoneId1 = Request.QueryString["User_ID"]; } else if (Request.Form["User_ID"] != null) { strPhoneId1 = Request.Form["User_ID"]; } if (!Int32.TryParse(Security.DecodeNumbers(Request.QueryString["ShopID"]), out iShopID)) { return; } } else { if (Request.QueryString["User_ID"] != null) { strPhoneId = Request.QueryString["User_ID"]; } else if (Request.Form["User_ID"] != null) { strPhoneId = Request.Form["User_ID"]; } } UserBL objUser = null; if (!String.IsNullOrEmpty(strPhoneId)) { //if phone user id is found objUser = UserBL.getDataByPhoneId(strPhoneId); } else { MyCustomerBL objMyCustomer = MyCustomerBL.getDataByShopIdNPhone(iShopID, strPhoneId1); if (objMyCustomer != null) { objUser = UserBL.getByActivityId(objMyCustomer.iUserId.Value); } } if (objUser != null) { //if user of that phone user id is found fill message info String strUserName = String.Empty; if (string.IsNullOrEmpty(objUser.strUserName)) { if (Request.QueryString["Phone_Owner_Name"] != null) { objUser.strUserName = Request.QueryString["Phone_Owner_Name"]; } else if (Request.Form["Phone_Owner_Name"] != null && !string.IsNullOrEmpty(Request.Form["Phone_Owner_Name"].ToString())) { objUser.strUserName = Request.Form["Phone_Owner_Name"]; } } //if (!String.IsNullOrEmpty(strUserName) && objUser.strFirstName != strUserName) //{ //if user's first name is changed replace it //objUser.strFirstName = strUserName; objUser.Save(); //} UserPreferredShopBL objUserPreferredShop = UserPreferredShopBL.getShopByUserId(objUser.ID); if (objUserPreferredShop != null || iShopID > 0) { String strMSG = String.Empty; //save the message against his preferred body shop MessageBL objMessage = new MessageBL(); objMessage.iPhoneUserID = objUser.ID; if (objUserPreferredShop != null) { objMessage.iShopID = objUserPreferredShop.iShopId; } else { objMessage.iShopID = iShopID; } objMessage.dtMessageTime = DateTime.Now; if (Request.QueryString["Message"] != null) { objMessage.strMessage = Request.QueryString["Message"].ToString(); } else if (Request.Form["Message"] != null) { objMessage.strMessage = Request.Form["Message"].ToString(); } String strType = String.Empty; if (Request.QueryString["MessageType"] != null) { strType = Request.QueryString["MessageType"].ToString(); } else if (Request.Form["MessageType"] != null) { strType = Request.Form["MessageType"].ToString(); } //Check isSendSMS flag to send SMS via Web Application Boolean bIsSendSMS = false; String strBodyShopPhone = String.Empty; if (Request.QueryString["sendSMS"] != null && Request.QueryString["sendSMS"].ToString() == "1") { bIsSendSMS = true; } BodyShopBL objBodyShop = null; if (objUserPreferredShop != null && objUserPreferredShop.iShopId.HasValue) { objBodyShop = BodyShopBL.getShopById(objUserPreferredShop.iShopId.Value); } else if (iShopID > 0) { objBodyShop = BodyShopBL.getShopById(iShopID); } if (objBodyShop != null && objBodyShop.strPhone != null) { strBodyShopPhone = objBodyShop.strPhone; } if (!String.IsNullOrEmpty(strType)) { switch (strType.ToLower()) { //select the message type eg. SMS, Email, Predefined SMS case "sms": objMessage.iType = Constants.SMS; if (bIsSendSMS) { if (!String.IsNullOrEmpty(strBodyShopPhone)) { SMS objSMS = new SMS(); objSMS.SendSMS(strBodyShopPhone, objMessage.strMessage, objUser.strPhone, objUser.ID); } } break; case "email": objMessage.iType = Constants.Email; break; case "predefinedsms": objMessage.iType = Constants.PredefinedSMS; break; } } //save the message n if saved return true to phone n remove cache if (objMessage.Save()) { bResult = true; if (objMessage.iType == Constants.PredefinedSMS) { if (Cache["OpportunityList"] != null) { Cache.Remove("OpportunityList"); } } else if (objMessage.iType == Constants.SMS || objMessage.iType == Constants.Email) { if (Cache["CommunicationList"] != null) { Cache.Remove("CommunicationList"); } } } } } } catch (Exception ex) { bResult = false; } XmlDocument xmlDoc = new XmlDocument(); MemoryStream stream = new MemoryStream(); //XmlTextWriter xmlWriter = new XmlTextWriter(stream, System.Text.Encoding.ASCII); XmlTextWriter xmlWriter = new XmlTextWriter(stream, System.Text.Encoding.UTF8); xmlWriter.WriteStartDocument(); xmlWriter.WriteStartElement("MessageReport"); xmlWriter.WriteElementString("Status", bResult ? "Success" : "Fail"); xmlWriter.WriteEndElement(); xmlWriter.WriteEndDocument(); xmlWriter.Flush(); byte[] byteArray = stream.ToArray(); HttpContext.Current.Response.Clear(); HttpContext.Current.Response.AppendHeader("Content-Disposition", "filename=MyExportedFile.xml"); HttpContext.Current.Response.AppendHeader("Content-Length", byteArray.Length.ToString()); HttpContext.Current.Response.ContentType = "text/xml"; HttpContext.Current.Response.BinaryWrite(byteArray); }
public static void ReadCallback(IAsyncResult ar) { try { String content = String.Empty; // Retrieve the state object and the handler socket // from the asynchronous state object. StateObject state = (StateObject)ar.AsyncState; Socket handler = state.workSocket; // Read data from the client socket. int bytesRead = handler.EndReceive(ar); // There might be more data, so store the data received so far. //state.sb.Append(Encoding.ASCII.GetString(state.buffer, 0, bytesRead)); state.sb.Append(Encoding.UTF8.GetString(state.buffer, 0, bytesRead)); if (handler.Available > 0) { // Not all data received. Get more. handler.BeginReceive(state.buffer, 0, StateObject.BufferSize, 0, new AsyncCallback(ReadCallback), state); } else { content = state.sb.ToString(); // All the data has been read from the // client. Display it on the console. //Console.WriteLine("Read {0} bytes from socket.", content.Length); // Log.WriteToLog(string.Format("Read {0} bytes from socket.", content.Length)); if (content.Length > 0) { QueryData receviedQueryData = QueryData.Deserialize(content); OnReciveMessage(new MessageEventArgs(receviedQueryData)); ReplyData returnedReplyData = null; switch (receviedQueryData.Type) { case Consts.SectionType.Message: returnedReplyData = MessageBL.executeQuery(receviedQueryData); // MessageBL.executeQuery(receviedQueryData); break; case Consts.SectionType.Processes: returnedReplyData = ProcessesBL.executeQuery(receviedQueryData); break; case Consts.SectionType.Performance: returnedReplyData = PerformanceBL.executeQuery(receviedQueryData); break; case Consts.SectionType.Properties: returnedReplyData = PropertiesBL.executeQuery(receviedQueryData); break; case Consts.SectionType.SysInfo: returnedReplyData = SysInfoBL.executeQuery(receviedQueryData); break; case Consts.SectionType.Status: returnedReplyData = new ReplyData(); returnedReplyData.ArrDataContainers = new ArrayList(); Counter cnter = new Counter(); cnter.Name = "UserName"; cnter.Value = Environment.UserName; Counter cnterhostName = new Counter(); cnterhostName.Name = "HostName"; cnterhostName.Value = Environment.UserName; var dc = new DataContainer("127.0.0.1"); dc.ArrCounters = new ArrayList(); dc.ArrCounters.Add(cnter); dc.ArrCounters.Add(cnterhostName); returnedReplyData.ArrDataContainers.Add(dc); break; case Consts.SectionType.CaptureScreen: if (CheckScreenCapture) { if (LastScreenCapture != null) { returnedReplyData = new ReplyData(); returnedReplyData.Type = Consts.SectionType.CaptureScreen; returnedReplyData.ArrDataContainers.Add(LastScreenCapture); } } else { returnedReplyData = CaptureScreenBL.executeQuery(receviedQueryData); } break; case Consts.SectionType.ExplorerLogicalDrive: foreach (ObjectMetaData CurrCounter in receviedQueryData.ArrCounter) { switch (CurrCounter.Tag) { case "ViewPath": try { DataContainer SysLogicalDirectoryDataContainer = new DataContainer("ViewPath"); System.IO.DirectoryInfo dinfo = new System.IO.DirectoryInfo(CurrCounter.Text); System.IO.DirectoryInfo[] AllDirectoryInfo = dinfo.GetDirectories(); foreach (System.IO.DirectoryInfo strDir in AllDirectoryInfo) { SysLogicalDirectoryDataContainer.ArrCounters.Add(new Counter("FolderName", strDir.Name + '-' + strDir.FullName + '-' + " ")); } foreach (System.IO.FileInfo strFile in dinfo.GetFiles()) { SysLogicalDirectoryDataContainer.ArrCounters.Add(new Counter("FileName", strFile.Name + '-' + strFile.FullName + '-' + " ")); } if (returnedReplyData == null) { returnedReplyData = new ReplyData(); } returnedReplyData.ArrDataContainers.Add(SysLogicalDirectoryDataContainer); } catch { } break; case "OSLogicalDrives": DataContainer SysLogicalDrivesDataContainer = new DataContainer("OSLogicalDrives"); System.IO.DriveInfo[] AllDriveInfo = System.IO.DriveInfo.GetDrives(); foreach (System.IO.DriveInfo CurrLogicalDrive in System.IO.DriveInfo.GetDrives()) { try { if (CurrLogicalDrive.Name == "A:\\") //Added by rm { // if (!CurrLogicalDrive.IsReady) SysLogicalDrivesDataContainer.ArrCounters.Add(new Counter("DiskName", CurrLogicalDrive.Name + '-' + CurrLogicalDrive.Name + '-' + "Not accessable" + '-' + "Not accessable")); continue; } if (CurrLogicalDrive.IsReady) { decimal FreeSpacePercent = decimal.Divide(CurrLogicalDrive.TotalFreeSpace, CurrLogicalDrive.TotalSize) * 10000; int tempNum = Convert.ToInt32(FreeSpacePercent); long TotalSizeMB = CurrLogicalDrive.TotalSize / 1000000; FreeSpacePercent = decimal.Divide(tempNum, 100); SysLogicalDrivesDataContainer.ArrCounters.Add(new Counter("DiskName", CurrLogicalDrive.Name + '-' + CurrLogicalDrive.Name + '-' + FreeSpacePercent.ToString() + "%" + '-' + TotalSizeMB.ToString("#,#", System.Globalization.CultureInfo.InvariantCulture))); } else { SysLogicalDrivesDataContainer.ArrCounters.Add(new Counter("DiskName", CurrLogicalDrive.Name + '-' + CurrLogicalDrive.Name + '-' + "Not accessable" + '-' + "Not accessable")); } } catch (Exception) { SysLogicalDrivesDataContainer.ArrCounters.Add(new Counter("DiskName", CurrLogicalDrive.Name + '-' + CurrLogicalDrive.Name + '-' + "Not accessable" + '-' + "Not accessable")); } } if (returnedReplyData == null) { returnedReplyData = new ReplyData(); } returnedReplyData.ArrDataContainers.Add(SysLogicalDrivesDataContainer); break; default: break; } } // returnedReplyData.ArrDataContainers.Add(SysLogicalDrivesDataContainer); break; default: break; } try { // Echo the data back to the client. if (returnedReplyData != null) { Send(handler, returnedReplyData.Serialize()); } else { } } catch (SocketException e) { Log.WriteToLog(e.ToString()); } } } } catch (Exception ex) { Log.WriteToLog(ex.ToString()); } }
protected void Page_Load(object sender, EventArgs e) { Boolean bResult = false; try { //String strPhoneId = String.Empty; ////get the phone user id //if (Request.QueryString["User_ID"] != null) // strPhoneId = Request.QueryString["User_ID"]; //else if (Request.Headers["User_ID"] != null) // strPhoneId = Request.Headers["User_ID"]; //else if (Request.Form["User_ID"] != null) // strPhoneId = Request.Form["User_ID"]; String strPhoneId = String.Empty; String strPhoneId1 = String.Empty; if (!String.IsNullOrEmpty(Request.QueryString["ShopID"])) { if (Request.QueryString["User_ID"] != null) { strPhoneId1 = Request.QueryString["User_ID"]; } else if (Request.Headers["User_ID"] != null) { strPhoneId = Request.Headers["User_ID"]; } else if (Request.Form["User_ID"] != null) { strPhoneId1 = Request.Form["User_ID"]; } if (!Int32.TryParse(Security.DecodeNumbers(Request.QueryString["ShopID"]), out iShopID)) { return; } } else { if (Request.QueryString["User_ID"] != null) { strPhoneId = Request.QueryString["User_ID"]; } else if (Request.Headers["User_ID"] != null) { strPhoneId = Request.Headers["User_ID"]; } else if (Request.Form["User_ID"] != null) { strPhoneId = Request.Form["User_ID"]; } } UserBL objUser = null; if (!String.IsNullOrEmpty(strPhoneId)) { string[] strPhones = strPhoneId.Split('_'); //find user using phoneID for private label if (strPhones.Length == 3) { objUser = UserBL.getDataByPhoneId(strPhoneId); } else { objUser = UserBL.GetDataByPhoneNumber(strPhones[0]); } if (objUser != null) { MyCustomerBL objMyCustomer = MyCustomerBL.getDataByUserId(objUser.ID); if (objMyCustomer != null) { iShopID = objMyCustomer.iShopId; } } } else { MyCustomerBL objMyCustomer = MyCustomerBL.getDataByShopIdNPhone(iShopID, strPhoneId1); if (objMyCustomer != null) { objUser = UserBL.getByActivityId(objMyCustomer.iUserId.Value); } } if (objUser != null) { //if user of previous phone user id is found fill his accident report information String strUserName = String.Empty; if (String.IsNullOrEmpty(objUser.strUserName)) { if (Request.QueryString["Phone_Owner_Name"] != null) { strUserName = Request.QueryString["Phone_Owner_Name"]; } else if (Request.Headers["Phone_Owner_Name"] != null) { strUserName = Request.Headers["Phone_Owner_Name"]; } else if (Request.Form["Phone_Owner_Name"] != null) { strUserName = Request.Form["Phone_Owner_Name"]; } } if (!String.IsNullOrEmpty(strUserName) && objUser.strFirstName != strUserName) { //if user's first name is changed objUser.strFirstName = strUserName; objUser.Save(); } UserPreferredShopBL objUserPreferredShop = UserPreferredShopBL.getShopByUserId(objUser.ID); MessageBL objMessage = null; if (objUserPreferredShop != null || iShopID > 0) { String strMessage = "Requested Appointment on: "; if (Request.QueryString["datetime"] != null) { strMessage = strMessage + String.Format("{0:g}", Convert.ToDateTime(Request.QueryString["datetime"].ToString())); } else if (Request.Headers["datetime"] != null) { strMessage = strMessage + String.Format("{0:g}", Convert.ToDateTime(Request.Headers["datetime"].ToString())); } else if (Request.Form["datetime"] != null) { DateTime dtAppointmentDate; DateTime.TryParse((Request.Form["datetime"].ToString()), out dtAppointmentDate); strMessage = strMessage + String.Format("{0:g}", dtAppointmentDate.ToString()); } if (Request.QueryString["reason"] != null) { strMessage = strMessage + " For: " + Request.QueryString["reason"].ToString(); } else if (Request.Headers["reason"] != null) { strMessage = strMessage + " For: " + Request.Headers["reason"].ToString(); } else if (Request.Form["reason"] != null) { strMessage = strMessage + " For: " + Request.Form["reason"].ToString(); } //add one message against his preferred shop objMessage = new MessageBL(); objMessage.strMessage = strMessage; objMessage.iPhoneUserID = objUser.ID; if (objUserPreferredShop != null) { objMessage.iShopID = objUserPreferredShop.iShopId; } else { objMessage.iShopID = iShopID; } objMessage.dtMessageTime = DateTime.Now; objMessage.iType = Constants.REQUEST_APPOINTMENT; if (objMessage.Save()) { bResult = true; } } else if (iShopID > 0) { String strMessage = "Requested Appointment on: "; if (Request.QueryString["datetime"] != null) { strMessage = strMessage + String.Format("{0:g}", Convert.ToDateTime(Request.QueryString["datetime"].ToString())); } else if (Request.Headers["datetime"] != null) { strMessage = strMessage + String.Format("{0:g}", Convert.ToDateTime(Request.Headers["datetime"].ToString())); } else if (Request.Form["datetime"] != null) { DateTime dtAppointmentDate; DateTime.TryParse((Request.Form["datetime"].ToString()), out dtAppointmentDate); strMessage = strMessage + String.Format("{0:g}", dtAppointmentDate.ToString()); } if (Request.QueryString["reason"] != null) { strMessage = strMessage + " For: " + Request.QueryString["reason"].ToString(); } else if (Request.Headers["reason"] != null) { strMessage = strMessage + " For: " + Request.Headers["reason"].ToString(); } else if (Request.Form["reason"] != null) { strMessage = strMessage + " For: " + Request.Form["reason"].ToString(); } //add one message against his preferred shop objMessage = new MessageBL(); objMessage.strMessage = strMessage; objMessage.iPhoneUserID = objUser.ID; objMessage.iShopID = iShopID; objMessage.dtMessageTime = DateTime.Now; objMessage.iType = Constants.REQUEST_APPOINTMENT; if (objMessage.Save()) { bResult = true; } } } } catch (Exception ex) { bResult = false; } XmlDocument xmlDoc = new XmlDocument(); MemoryStream stream = new MemoryStream(); //XmlTextWriter xmlWriter = new XmlTextWriter(stream, System.Text.Encoding.ASCII); XmlTextWriter xmlWriter = new XmlTextWriter(stream, System.Text.Encoding.UTF8); xmlWriter.WriteStartDocument(); xmlWriter.WriteStartElement("ScheduleRepairAppointment"); xmlWriter.WriteElementString("Status", bResult ? "Success" : "Fail"); xmlWriter.WriteEndElement(); xmlWriter.WriteEndDocument(); xmlWriter.Flush(); byte[] byteArray = stream.ToArray(); HttpContext.Current.Response.Clear(); HttpContext.Current.Response.AppendHeader("Content-Disposition", "filename=MyExportedFile.xml"); HttpContext.Current.Response.AppendHeader("Content-Length", byteArray.Length.ToString()); HttpContext.Current.Response.ContentType = "text/xml"; HttpContext.Current.Response.BinaryWrite(byteArray); }