Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
2.00/5 (3 votes)
See more:
Hi,

we have developed a web application using asp.net with c#. at some point of time we facing a very diificult issue.

let me explain my issue,

Two users(A and B) send Email at same time using mailmessage.
that Email body content was change B user Email body content goes to A user.

code:
C#
public override string SendReplyMail_To_Client(string TICKETNUMBER, string REPLYMESSAGE, int TemplateNumber, int Portal_Id, int Module_Id, string FromEmail, string ToEmail, string Att, string Added_CC, string subject, out string Error, out string ReplyError)
       {


ds_reply_mail = DataProvider.Instance().Get_EmailTemplates_By_TemplateNumber(SqlParam);
C#
EmailSubject = ds_reply_mail.Tables[0].Rows[0]["EmailSubject"].ToString().Trim();
                         EmailText = DataProvider.Instance().Get_String((Byte[])ds_reply_mail.Tables[0].Rows[0]["EmailText"]);


C#
for (int ColumnIndex = 0; ColumnIndex < ds_ticket.Tables[0].Columns.Count; ColumnIndex++)
                       {
                           if (EmailText.Contains(ds_ticket.Tables[0].Columns[ColumnIndex].ColumnName.Trim()))
                           {
                               if (ds_ticket.Tables[0].Columns[ColumnIndex].ColumnName.Trim() != "#REQUESTDESC#")
                               {
                                   EmailText = EmailText.Replace(ds_ticket.Tables[0].Columns[ColumnIndex].ColumnName.Trim(), ds_ticket.Tables[0].Rows[0][ds_ticket.Tables[0].Columns[ColumnIndex].ColumnName.Trim()].ToString().Trim());
                                   //EmailSubject = EmailSubject.Replace(ds_ticket.Tables[0].Columns[ColumnIndex].ColumnName.Trim(), ds_ticket.Tables[0].Rows[0][ds_ticket.Tables[0].Columns[ColumnIndex].ColumnName.Trim()].ToString().Trim());
                               }
                               else
                               {
                                   EmailText = EmailText.Replace(ds_ticket.Tables[0].Columns[ColumnIndex].ColumnName.Trim(),  DataProvider.Instance().Get_String((Byte[])ds_ticket.Tables[0].Rows[0][ds_ticket.Tables[0].Columns[ColumnIndex].ColumnName.Trim()]));
                                  // EmailSubject = EmailSubject.Replace(ds_ticket.Tables[0].Columns[ColumnIndex].ColumnName.Trim(), ds_ticket.Tables[0].Rows[0][ds_ticket.Tables[0].Columns[ColumnIndex].ColumnName.Trim()].ToString().Trim());
                               }
                           }
                       }

                       // Email Subject Replacement
                       for (int ColumnIndex = 0; ColumnIndex < ds_ticket.Tables[0].Columns.Count; ColumnIndex++)
                       {
                           if (EmailSubject.Contains(ds_ticket.Tables[0].Columns[ColumnIndex].ColumnName.Trim()))
                           {
                               if (ds_ticket.Tables[0].Columns[ColumnIndex].ColumnName.Trim() != "#REQUESTDESC#")
                               {
                                  EmailSubject = EmailSubject.Replace(ds_ticket.Tables[0].Columns[ColumnIndex].ColumnName.Trim(), ds_ticket.Tables[0].Rows[0][ds_ticket.Tables[0].Columns[ColumnIndex].ColumnName.Trim()].ToString().Trim());
                               }
                               else
                               {
                                   EmailSubject = EmailSubject.Replace(ds_ticket.Tables[0].Columns[ColumnIndex].ColumnName.Trim(), ds_ticket.Tables[0].Rows[0][ds_ticket.Tables[0].Columns[ColumnIndex].ColumnName.Trim()].ToString().Trim());
                               }
                           }
                       }


                       if (EmailText.Contains("#REPLYMESSAGE#"))
                       {
                           EmailText = "<font style='color:Black'>" + EmailText.Replace("#REPLYMESSAGE#", REPLYMESSAGE) + "</font>";//EmailText.Replace("#REPLYMESSAGE#", REPLYMESSAGE);
                       }


                       MailMessage Mail = new MailMessage();
                       Mail.From = FromEmail;

Mail.To = cc;
C#
if (subject != null && subject != "")
                               Mail.Subject = subject;
                           else
                               Mail.Subject = EmailSubject;
                           Mail.BodyFormat = MailFormat.Html;
   Mail.Body = EmailText;
                                SmtpMail.SmtpServer = Get_SMTP_Host_Server_Name();
SmtpMail.Send(Mail);



}
how can i handle this issue in my application?
Posted
Updated 5-Feb-13 3:51am
v4
Comments
OriginalGriff 5-Feb-13 2:49am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
Use the "Improve question" widget to edit your question and provide better information.
Joezer BH 5-Feb-13 4:47am    
forget the question, it's a horrible title...
avmvijay 6-Feb-13 3:55am    
what u mean?
Joezer BH 6-Feb-13 4:58am    
The title should have a short description of the nature of the issue you encounter.

Stating that you have an issue to resolve is a waste of the title, since that is clear by the fact that you are posting a question.
Furthermore - the title is used for searches of similar old questions that have already been anwered. So by not providing details your question will be of less use to future users.
RDBurmon 5-Feb-13 3:48am    
avmvijay , Can you predict smell of coffee by seeing "ASAM" in indian map ?
We are CP member not astrologers.

1 solution

Without seeing your code, we can't be precise, but I would suggest that you need to look at what you are doing - somehow you are using information as if your app was the only one running.
Check:
1) You should not be using static variables.
2) You should not be storing information is a single place in a database and assuming that no other user can also see it.
3) You should not be using the "highest value" as the "my value" to provide an ID - if another user does the same thing inbetween your write and your read, you will get his values.

You should be using the Session object, or Cookies on the user PC to transfer data from page to page.

Sorry if this is all vague, but without information we can be no more accurate.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900