I am trying test a method. The method takes in a single argument, which belongs to the class HttpContext in NET Framework Class Library. So I guess I need to prepare an object of HttpContext.
All that the method needs from the argument, say context, are
context.Request.QueryStringcontext.Request.Headers
Here are my thoughts and questions
-
To learn how to use
HttpContext, I click going to definition in Visual Studio, I found that the class has a constructorpublic HttpContext(HttpRequest request, HttpResponse response);so I need to provide its two arguments, in order to create a object of the class.
To provide an object of HttpRequest, I found its constructor
// // Summary: // Initializes an System.Web.HttpRequest object. // // Parameters: // filename: // The name of the file associated with the request. // // url: // The information regarding the URL of the current request. // // queryString: // The entire query string sent with the request (everything after the'?'). public HttpRequest(string filename, string url, string queryString);-
What does
filenamemean? -
Which is
url, the full url containing the query strings, or just the part before??
-
-
After I can create an object of HttpContext, do I need to call some method to parse the url and query strings to obtain
context.Request.QueryStringcontext.Request.Headers
or the
HttpContextwill implicitly do the work without me explicitly calling any method?
Thanks.
Aucun commentaire:
Enregistrer un commentaire