1. Review:
In the previous article, we gave a detailed introduction to the RemoteCallHandler, including its own internal stream theft and data parsing during access, this allows functions in JavaScript to interact with cs and provides a general understanding of this knowledge.
2. Introduction:
This chapter also introduces RemoteCallHandler. Why do we still introduce this kind of feature? Because we use different browsers in different regions, we will generate redundant characters in our requestHandler, the gzip header file will appear. To solve this header file problem, we will modify the previous code.
3. Modify the RemoteCallHandler class:
Original code
/* Obtain the name of the background function to be called */
String methodName = request. Headers ["CallingMethod"];
/* Determine whether the operation type name is null */
If (string. IsNullOrEmpty (typeName) {throw new MissingCallingTypeException ();}
/* Determine whether the called background function name is null */
If (string. IsNullOrEmpty (methodName) {throw new MissingCallingMethodException ();}
Modified code
// Main position to be modified: Here, after matching with a regular expression with special characters, take the subsequent character information directly.
Match m = Regex. Match (request. Headers ["CallingMethod"]. Replace (";",""),@"(? <Method> \ w +) 517 MethodEnd ");
If (! M. Success ){
LogUtility. txtLog. writeTraceLog (string. format ("User: {0} \ tAssembly: {1} \ tTypeName: {2} \ tMethodName: {3}", (HttpContext. current. session ["LoginStaff"] as Better. model. MStaffInfo ). staff_id, assembly, typeName, request. headers ["CallingMethod"]);
Throw new MissingCallingMethodException ();
}
String methodName = m. Groups ["method"]. Value;
The basic modification is only here, so we are no longer afraid of gzip in requestheader. Next we will talk about the call in js.