J
Jason Madison
I have been reading some asp.net code and wondered why it uses HttpContext.
On one page this is done:
// ------------------------------------------------------------------------
HttpContext ctx = HttpContext.Current;
string chartID = Guid.NewGuid ().ToString ();
ctx.Session [chartID] = byteArr;
imgHondaLineup.ImageUrl = string.Concat ("chart.ashx?", chartID);
then in the code behind the chart.ashx page this is done:
public void ProcessRequest (HttpContext ctx)
{
string chartID = ctx.Request.QueryString[0];
Array arr = (Array) ctx.Session [chartID];
....
ctx.Response.ContentType = "image/png";
ctx.Response.StatusCode = 200;
ctx.Response.End ();
What I want to understand is what would be the difference if the HttpContext
instance wasn't used. E.g.
Session [chartID] = byteArr;
....
string chartID = Request.QueryString[0];
Array arr = (Array) Session [chartID];
....
....
Response.ContentType = "image/png";
Response.StatusCode = 200;
etc.
Thanks
On one page this is done:
// ------------------------------------------------------------------------
HttpContext ctx = HttpContext.Current;
string chartID = Guid.NewGuid ().ToString ();
ctx.Session [chartID] = byteArr;
imgHondaLineup.ImageUrl = string.Concat ("chart.ashx?", chartID);
then in the code behind the chart.ashx page this is done:
public void ProcessRequest (HttpContext ctx)
{
string chartID = ctx.Request.QueryString[0];
Array arr = (Array) ctx.Session [chartID];
....
ctx.Response.ContentType = "image/png";
ctx.Response.StatusCode = 200;
ctx.Response.End ();
What I want to understand is what would be the difference if the HttpContext
instance wasn't used. E.g.
Session [chartID] = byteArr;
....
string chartID = Request.QueryString[0];
Array arr = (Array) Session [chartID];
....
....
Response.ContentType = "image/png";
Response.StatusCode = 200;
etc.
Thanks