I tried all the complex ways to do something which turned out to be quite simple.
I had a need to show nice-looking custom error page in my asp.net application for all folders except one. That special folder needed to return a proper error code and not a 302 (redirect to a custom error page) status.
While it was simple enough to make the custom error page set a Response.StatusCode = 500, I could tell with my Http Proxy sniffing tool Fiddler that the first code sent was the 302. This wasn’t good. I had to be sure that if there was an error, that the requesting client got an error code, not a redirect code, and worse yet, a redirect to a 200 OK code.
The solution was simple: in my application’s web.config, set a location-specific customErrors directive:
<location path="specialFolder">
<system.web>
<customErrors defaultRedirect="" mode="RemoteOnly"></customErrors>
</system.web>
</location>
The important part here is to specify a defaultRedirect="". This solved my issue, and is now good again.
When you are ready to upgrade from an installed trial edition of Visual Studio or Team Foundation Server (or the Workgroup Edition of Team Foundation Server), you don't have to completely uninstall and reinstall those products. For more information, see How to: Upgrade from Visual Studio Trial Edition (a Visual Studio 2005 topic, but still accurate).
Today I was using c#'s new Linq technology to query a list of objects. To keep my test simple, I decided to try ordering my objects.
My code look looked like this:
var query = from o in referrals orderby o.Email select o;
I bound this to a gridview. Everything looked ok until runtime. My datagrid complained:
The data source does not support server-side data paging.
A quick google search revealed a post by Scott Guthrie. I need to tell Linq that I wanted this list back in a form that the datagrid could page. Modified:
var query = (from o in referrals orderby o.Email select o).ToList() ;
This worked well, and gave me my referral list back, ordered by the Referral object's Email attribute. Of course, this only scratches the surface of what Linq can do, as filtering or joining of that list would be better examples of the power of Linq.
Line 78: <compilers> Line 79: <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4"> Line 80: <providerOption name="CompilerVersion" value="v3.5"/> Line 81: <providerOption name="WarnAsError" value="false"/></compiler></compilers></system.codedom> Line 82: <runtime> |