在javascript中我称之为
//check for duplicate profiles on server side
PageMethods.CheckForDuplicates(FirstName, LastName, LinkedIn, email, function (result) { alert(result);}, function (result) { alert(result);});
它调用的webservice方法如下
[System.Web.Services.WebMethod]
public static string CheckForDuplicates(string sFirstName, string sLastName, string sLinkedIn, string sEmail)
{
string sError = "";
sError = "A possible duplicate profile was found with the following information\\n";
sError += "Profile ID:" + pDuplicateProfile.ProfileID + "\\n";
sError += "First Name:" + pDuplicateProfile.FirstName; if (string.Equals(pDuplicateProfile.FirstName.ToLower() + pDuplicateProfile.LastName.ToLower(), pTempProfileData.FirstName.ToLower() + pTempProfileData.LastName.ToLower())) { sError += " <======NAME DUPLICATE===\\n"; } else { sError += "\\n"; }
sError += "Last Name:" + pDuplicateProfile.LastName + "\\n";
sError += "Work Email:" + pDuplicateProfile.BusinessEmail; if (pTempProfileData.BusinessEmail != "" && (pDuplicateProfile.BusinessEmail.ToLower().Contains(pTempProfileData.BusinessEmail.ToLower()) || pTempProfileData.BusinessEmail.ToLower().Contains(pDuplicateProfile.BusinessEmail.ToLower()))) { sError += " <======BUSINESS EMAIL DUPLICATE===\\n"; } else { sError += "\\n"; }
sError += "LinkedIn:" + pDuplicateProfile.LinkedIn; if (pTempProfileData.LinkedIn != "" && string.Equals(pDuplicateProfile.LinkedIn.ToLower(), pTempProfileData.LinkedIn.ToLower())) { sError += " <======LINKED IN DUPLICATE===\\n"; } else { sError += "\\n"; }
sError += "Please correct the problem and try again\\n";
sError += "If you would like to continue to enter the information regardless (or make changes first)";
return sError;
}
问题是所有的双反斜杠都是打印的,而不是实际做反斜杠n,当我通过服务器端调用它时它确实有新的行,因此在从服务器到服务器的传输过程中,某种方式(某些XML的东西或某种东西)客户端的回车被忽略。