The Artima Developer Community
Sponsored Link

.NET Buzz Forum
HttpContext.Current

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Scott Watermasysk

Posts: 661
Nickname: scottwater
Registered: Aug, 2003

Scott Watermasysk is an ASP.NET developers. He wrote the .Text blog engine.
HttpContext.Current Posted: Feb 11, 2004 6:32 AM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Scott Watermasysk.
Original Post: HttpContext.Current
Feed Title: ScottW's ASP.NET WebLog
Feed URL: /error.aspx?aspxerrorpath=/blog/rss.aspx
Feed Description: ASP.NET and Blogging
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Scott Watermasysk
Latest Posts From ScottW's ASP.NET WebLog

Advertisement

Oddur Magnusson wrote that he recently found HttpContext.Current and was about to refactor his code, so that he did not need to pass in the current Context as a parameter.

While this will work, using a simple overload can give you both the flexibility of not having to pass in the current context if it is not readily available as well as a performance gain for being able to use a current HttpContext reference when it is available.

Here is a quick example of grabbing an item from the Context.Items collection.

public string GetValue(HttpContext Context)

{
return Context.Items[key] as string;
}

public string GetValue()
{
return GetValue(HttpContext.Current);
}

Read: HttpContext.Current

Topic: Just clearing out the archives... Previous Topic   Next Topic Topic: Longhorn Preview: just few thoughts, nothing seriously damaging :-)

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use