private static string UrlEncodeCookie(string strIn) { if ((strIn == null) || (strIn.Length < 1)) { return(string.Empty); } int index = strIn.IndexOf('='); if (index < 0) { return(HttpUtility.AspCompatUrlEncode(strIn)); } index++; int startIndex = strIn.IndexOf(';', index); if (startIndex < 0) { return(HttpUtility.AspCompatUrlEncode(strIn)); } string str = strIn.Substring(0, index); string s = strIn.Substring(index, startIndex - index); string str3 = strIn.Substring(startIndex, strIn.Length - startIndex); return(str + HttpUtility.AspCompatUrlEncode(s) + str3); }
private static string UrlEncodeCookie(string strIn) { if (strIn == null || strIn.Length < 1) { return(String.Empty); } int iPos1 = strIn.IndexOf('='); if (iPos1 < 0) { return(HttpUtility.AspCompatUrlEncode(strIn)); } iPos1++; int iPos2 = strIn.IndexOf(';', iPos1); if (iPos2 < 0) { return(HttpUtility.AspCompatUrlEncode(strIn)); } string str1 = strIn.Substring(0, iPos1); string str2 = strIn.Substring(iPos1, iPos2 - iPos1); string str3 = strIn.Substring(iPos2, strIn.Length - iPos2); return(str1 + HttpUtility.AspCompatUrlEncode(str2) + str3); }