<?xml version="1.0" ?><rss version="2.0" xmlns:ec="http://www.eggheadcafe.com"><channel><title>eggheadcafe.com ASP.NET FAQs</title><link>http://www.eggheadcafe.com</link><pubDate>Fri, 26 Apr 2013 14:08:57 GMT</pubDate><description>EggHeadCafe - The .NET developer's portal of choice</description><language>en-us</language><item><title><![CDATA[Perform Server.MapPath When HttpContext Not Available]]></title><guid isPermaLink="true"><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/9bfee15d-6fae-422a-9f1d-070b8c9fea5a/perform-servermappath-when-httpcontext-not-available.aspx]]></guid><link><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/9bfee15d-6fae-422a-9f1d-070b8c9fea5a/perform-servermappath-when-httpcontext-not-available.aspx]]></link><description><![CDATA[There are certain situations  - particularly in Global.asax where you need to map a path but the HttpContext.Current property is null.Here is a simple method that works around this issue.&nbsp;&nbsp;<a href="http://www.eggheadcafe.com/sample-code/ASP.NET/9bfee15d-6fae-422a-9f1d-070b8c9fea5a/perform-servermappath-when-httpcontext-not-available.aspx" target="_self">read more</a>]]></description><pubDate>Thu, 12 Jul 2012 12:57:32 GMT</pubDate></item><item><title><![CDATA[IHttpAsyncHandler, IRequiresSessionState, and IReadOnlySessionState Asynchronous Handler Issue]]></title><guid isPermaLink="true"><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/3eaacbed-985f-493a-92dc-10e665b32b0e/ihttpasynchandler-irequiressessionstate-and-ireadonlysessionstate-asynchronous-handler-issue.aspx]]></guid><link><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/3eaacbed-985f-493a-92dc-10e665b32b0e/ihttpasynchandler-irequiressessionstate-and-ireadonlysessionstate-asynchronous-handler-issue.aspx]]></link><description><![CDATA[Here's a quick tip for getting access to Session state if you are using asynchronous http handlers.  I've run into issues where System.Web.HttpContext.Current.Session did not contain any sessions variables.  Didn't matter whether I used IRequiresSessionState or IReadOnlySessionState.  I use a nice wrapper class for my session variables and just couldn't figure out why it wasn't working.&nbsp;&nbsp;<a href="http://www.eggheadcafe.com/sample-code/ASP.NET/3eaacbed-985f-493a-92dc-10e665b32b0e/ihttpasynchandler-irequiressessionstate-and-ireadonlysessionstate-asynchronous-handler-issue.aspx" target="_self">read more</a>]]></description><pubDate>Mon, 09 Apr 2012 16:55:24 GMT</pubDate></item><item><title><![CDATA[ViewStateMode and EnableViewState]]></title><guid isPermaLink="true"><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/121faec9-3bc7-4628-85c0-3f3389ce674b/viewstatemode-and-enableviewstate.aspx]]></guid><link><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/121faec9-3bc7-4628-85c0-3f3389ce674b/viewstatemode-and-enableviewstate.aspx]]></link><description><![CDATA[Often developers can get confused about the various settings for ViewState on pages and individual controls. This is because the settings themselves are confusing!&nbsp;&nbsp;<a href="http://www.eggheadcafe.com/sample-code/ASP.NET/121faec9-3bc7-4628-85c0-3f3389ce674b/viewstatemode-and-enableviewstate.aspx" target="_self">read more</a>]]></description><pubDate>Tue, 17 Jan 2012 09:19:29 GMT</pubDate></item><item><title><![CDATA[ASP.NET: Get the size of a file without downloading it]]></title><guid isPermaLink="true"><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/7f7d65d1-dfa2-42b5-ac4c-f039f51440b2/aspnet-get-the-size-of-a-file-without-downloading-it.aspx]]></guid><link><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/7f7d65d1-dfa2-42b5-ac4c-f039f51440b2/aspnet-get-the-size-of-a-file-without-downloading-it.aspx]]></link><description><![CDATA[Some time ago I made a post on this subject, and I revisited it to check on timings.An easy way to get the size of a file over the web is to make a HEAD request for the resource and then examine the Content-Length Header. But there is another way: You can open a WebRequest, get the Response, examine  ResponseHeaders["Content-Length"], and then immediately close the stream without reading any of it. Which do you think is faster?&nbsp;&nbsp;<a href="http://www.eggheadcafe.com/sample-code/ASP.NET/7f7d65d1-dfa2-42b5-ac4c-f039f51440b2/aspnet-get-the-size-of-a-file-without-downloading-it.aspx" target="_self">read more</a>]]></description><pubDate>Fri, 23 Dec 2011 14:34:47 GMT</pubDate></item><item><title><![CDATA[UrlEncode vs UrlPathEncode]]></title><guid isPermaLink="true"><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/fd856064-fcf0-4c26-bb75-c807d6b047dd/urlencode-vs-urlpathencode.aspx]]></guid><link><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/fd856064-fcf0-4c26-bb75-c807d6b047dd/urlencode-vs-urlpathencode.aspx]]></link><description><![CDATA[The HttpUtility class offers several utility methods to encode Urls. Here are the differences.&nbsp;&nbsp;<a href="http://www.eggheadcafe.com/sample-code/ASP.NET/fd856064-fcf0-4c26-bb75-c807d6b047dd/urlencode-vs-urlpathencode.aspx" target="_self">read more</a>]]></description><pubDate>Thu, 03 Nov 2011 19:16:49 GMT</pubDate></item><item><title><![CDATA[ASP.Net MVC - Use the AdditionalMetadata attribute to pass additional data to the views.]]></title><guid isPermaLink="true"><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/0342e703-829c-4eb1-b3aa-ced65dff043e/aspnet-mvc--use-the-additionalmetadata-attribute-to-pass-additional-data-to-the-views.aspx]]></guid><link><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/0342e703-829c-4eb1-b3aa-ced65dff043e/aspnet-mvc--use-the-additionalmetadata-attribute-to-pass-additional-data-to-the-views.aspx]]></link><description><![CDATA[The [AdditionalMetadata] attribute is a powerful feature of MVC 3. You can make use of this attribute and pass additional data that will help you make judgements in scenarios where you need to display/take decisions conditionally. The following example makes it more clear.&nbsp;&nbsp;<a href="http://www.eggheadcafe.com/sample-code/ASP.NET/0342e703-829c-4eb1-b3aa-ced65dff043e/aspnet-mvc--use-the-additionalmetadata-attribute-to-pass-additional-data-to-the-views.aspx" target="_self">read more</a>]]></description><pubDate>Thu, 27 Oct 2011 11:56:56 GMT</pubDate></item><item><title><![CDATA[ASP.Net MVC- How to change master page for a view at runtime?]]></title><guid isPermaLink="true"><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/8ee57463-aa65-45c3-9dba-cb0dd64266bf/aspnet-mvc-how-to-change-master-page-for-a-view-at-runtime.aspx]]></guid><link><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/8ee57463-aa65-45c3-9dba-cb0dd64266bf/aspnet-mvc-how-to-change-master-page-for-a-view-at-runtime.aspx]]></link><description><![CDATA[You can pass the master page name when you return the ViewResult from the Controller's Action.&nbsp;&nbsp;<a href="http://www.eggheadcafe.com/sample-code/ASP.NET/8ee57463-aa65-45c3-9dba-cb0dd64266bf/aspnet-mvc-how-to-change-master-page-for-a-view-at-runtime.aspx" target="_self">read more</a>]]></description><pubDate>Thu, 27 Oct 2011 11:57:30 GMT</pubDate></item><item><title><![CDATA[ASP.Net MVC - How do I apply a CSS class to html.ActionLink in MVC?]]></title><guid isPermaLink="true"><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/4c96d66d-96dd-415d-b8c9-837229a0a79d/aspnet-mvc--how-do-i-apply-a-css-class-to-htmlactionlink-in-mvc.aspx]]></guid><link><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/4c96d66d-96dd-415d-b8c9-837229a0a79d/aspnet-mvc--how-do-i-apply-a-css-class-to-htmlactionlink-in-mvc.aspx]]></link><description><![CDATA[Use the ActionLink overloaded method that takes the html attributes that would be applied to the generated link.&nbsp;&nbsp;<a href="http://www.eggheadcafe.com/sample-code/ASP.NET/4c96d66d-96dd-415d-b8c9-837229a0a79d/aspnet-mvc--how-do-i-apply-a-css-class-to-htmlactionlink-in-mvc.aspx" target="_self">read more</a>]]></description><pubDate>Thu, 27 Oct 2011 10:20:11 GMT</pubDate></item><item><title><![CDATA[JQuery - How do I turn off/disable animations?]]></title><guid isPermaLink="true"><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/4247667e-7fd9-4c5d-b313-b08c869d6c39/jquery--how-do-i-turn-offdisable-animations.aspx]]></guid><link><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/4247667e-7fd9-4c5d-b313-b08c869d6c39/jquery--how-do-i-turn-offdisable-animations.aspx]]></link><description><![CDATA[JQuery animations can be turned off/disable using the fx.off property.&nbsp;&nbsp;<a href="http://www.eggheadcafe.com/sample-code/ASP.NET/4247667e-7fd9-4c5d-b313-b08c869d6c39/jquery--how-do-i-turn-offdisable-animations.aspx" target="_self">read more</a>]]></description><pubDate>Fri, 30 Sep 2011 09:43:30 GMT</pubDate></item><item><title><![CDATA[JQuery - Get the selected item's text in a dropdown]]></title><guid isPermaLink="true"><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/6701c2df-0f46-47a7-a318-be27be1255ee/jquery--get-the-selected-items-text-in-a-dropdown.aspx]]></guid><link><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/6701c2df-0f46-47a7-a318-be27be1255ee/jquery--get-the-selected-items-text-in-a-dropdown.aspx]]></link><description><![CDATA[Use the ":selected" modifier on the option element.&nbsp;&nbsp;<a href="http://www.eggheadcafe.com/sample-code/ASP.NET/6701c2df-0f46-47a7-a318-be27be1255ee/jquery--get-the-selected-items-text-in-a-dropdown.aspx" target="_self">read more</a>]]></description><pubDate>Tue, 27 Sep 2011 11:19:07 GMT</pubDate></item><item><title><![CDATA[ASP.Net - Global.asax Application_Start event does not fire]]></title><guid isPermaLink="true"><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/b8848200-f97e-47d9-a926-5492c8870be1/aspnet--globalasax-applicationstart-event-does-not-fire.aspx]]></guid><link><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/b8848200-f97e-47d9-a926-5492c8870be1/aspnet--globalasax-applicationstart-event-does-not-fire.aspx]]></link><description><![CDATA[There are many threads on the internet that tell you to play with Session or any other web.config values to get Global.asax events working. If they do not work, then this tip is for you.&nbsp;&nbsp;<a href="http://www.eggheadcafe.com/sample-code/ASP.NET/b8848200-f97e-47d9-a926-5492c8870be1/aspnet--globalasax-applicationstart-event-does-not-fire.aspx" target="_self">read more</a>]]></description><pubDate>Sat, 13 Aug 2011 18:29:15 GMT</pubDate></item><item><title><![CDATA[ASP.NET Master Page Controls and Accessing From a Content Page]]></title><guid isPermaLink="true"><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/36f0bda6-6fcc-4330-ba21-a7043a1be3fb/aspnet-master-page-controls-and-accessing-from-a-content-page.aspx]]></guid><link><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/36f0bda6-6fcc-4330-ba21-a7043a1be3fb/aspnet-master-page-controls-and-accessing-from-a-content-page.aspx]]></link><description><![CDATA[The sample below describes how we can access the  masterPage controls from the content page.  Suppose we have a TextBox in the master page and we need to set the text to in the click event of Button which is in Content page.&nbsp;&nbsp;<a href="http://www.eggheadcafe.com/sample-code/ASP.NET/36f0bda6-6fcc-4330-ba21-a7043a1be3fb/aspnet-master-page-controls-and-accessing-from-a-content-page.aspx" target="_self">read more</a>]]></description><pubDate>Mon, 08 Aug 2011 08:40:59 GMT</pubDate></item><item><title><![CDATA[Difference between IEnumerable and IQueryable]]></title><guid isPermaLink="true"><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/b7492955-eb16-4334-b656-26a7a2b19bec/difference-between-ienumerable-and-iqueryable.aspx]]></guid><link><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/b7492955-eb16-4334-b656-26a7a2b19bec/difference-between-ienumerable-and-iqueryable.aspx]]></link><description><![CDATA[Here is the small sample that explains the difference between IEnumerable<T> and IQueryable<T>.&nbsp;&nbsp;<a href="http://www.eggheadcafe.com/sample-code/ASP.NET/b7492955-eb16-4334-b656-26a7a2b19bec/difference-between-ienumerable-and-iqueryable.aspx" target="_self">read more</a>]]></description><pubDate>Mon, 01 Aug 2011 08:46:39 GMT</pubDate></item><item><title><![CDATA[How to Add Tooltips to an ASP.NET Dropdownlist]]></title><guid isPermaLink="true"><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/dc61f50d-edf1-453f-98dc-1842663f5792/how-to-add-tooltips-to-an-aspnet-dropdownlist.aspx]]></guid><link><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/dc61f50d-edf1-453f-98dc-1842663f5792/how-to-add-tooltips-to-an-aspnet-dropdownlist.aspx]]></link><description><![CDATA[A DropdownList can be enhanced with Tooltips for its items including the selected item.&nbsp;&nbsp;<a href="http://www.eggheadcafe.com/sample-code/ASP.NET/dc61f50d-edf1-453f-98dc-1842663f5792/how-to-add-tooltips-to-an-aspnet-dropdownlist.aspx" target="_self">read more</a>]]></description><pubDate>Sat, 30 Jul 2011 12:33:21 GMT</pubDate></item><item><title><![CDATA[Event Handling in Repeater Control]]></title><guid isPermaLink="true"><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/4744002b-fda1-4dac-8a68-89af8a3c944b/event-handling-in-repeater-control.aspx]]></guid><link><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/4744002b-fda1-4dac-8a68-89af8a3c944b/event-handling-in-repeater-control.aspx]]></link><description><![CDATA[When controls are placed in Repeater Control we have to write OnItemCommand () Event for RepeaterControl and determine which control has raised the events. Events are bubbled between the controls that is if as button is placed in Repeater and the Repeater has OnItemCommand () Event and also the button has Click Event then both the events will be fired and so it is always safe to write events only for Top-Level Controls&nbsp;&nbsp;<a href="http://www.eggheadcafe.com/sample-code/ASP.NET/4744002b-fda1-4dac-8a68-89af8a3c944b/event-handling-in-repeater-control.aspx" target="_self">read more</a>]]></description><pubDate>Wed, 03 Aug 2011 11:11:54 GMT</pubDate></item><item><title><![CDATA[ASP.Net MVC - How to validate the route values? Can I control the routes using the type of the values?]]></title><guid isPermaLink="true"><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/ff4f7da0-03cb-4aee-a8e8-9253c5f3c03b/aspnet-mvc--how-to-validate-the-route-values-can-i-control-the-routes-using-the-type-of-the-values.aspx]]></guid><link><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/ff4f7da0-03cb-4aee-a8e8-9253c5f3c03b/aspnet-mvc--how-to-validate-the-route-values-can-i-control-the-routes-using-the-type-of-the-values.aspx]]></link><description><![CDATA[One of the best ways is to use the RouteConstraint to validate the route values and then choose a route to controller. Route values that hold values of integer is the best example. If the route value is passed as string which cannot be converted to an Integer, we suffer with run-time and unhandled exceptions on our code.&nbsp;&nbsp;<a href="http://www.eggheadcafe.com/sample-code/ASP.NET/ff4f7da0-03cb-4aee-a8e8-9253c5f3c03b/aspnet-mvc--how-to-validate-the-route-values-can-i-control-the-routes-using-the-type-of-the-values.aspx" target="_self">read more</a>]]></description><pubDate>Thu, 07 Jul 2011 06:52:12 GMT</pubDate></item><item><title><![CDATA[jQuery - How do I Load a URL in a div]]></title><guid isPermaLink="true"><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/71cc9933-8537-45aa-929d-5d14023d50e2/jquery--how-do-i-load-a-url-in-a-div.aspx]]></guid><link><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/71cc9933-8537-45aa-929d-5d14023d50e2/jquery--how-do-i-load-a-url-in-a-div.aspx]]></link><description><![CDATA[Use the Load method to load the html from a url into an element using jQuery. You will have to ensure that the url belongs to the same domain.&nbsp;&nbsp;<a href="http://www.eggheadcafe.com/sample-code/ASP.NET/71cc9933-8537-45aa-929d-5d14023d50e2/jquery--how-do-i-load-a-url-in-a-div.aspx" target="_self">read more</a>]]></description><pubDate>Thu, 07 Jul 2011 06:51:25 GMT</pubDate></item><item><title><![CDATA[How to Determine if an Uploaded image is valid]]></title><guid isPermaLink="true"><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/65197f4f-24ec-4fff-a44f-9747635dce51/how-to-determine-if-an-uploaded-image-is-valid.aspx]]></guid><link><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/65197f4f-24ec-4fff-a44f-9747635dce51/how-to-determine-if-an-uploaded-image-is-valid.aspx]]></link><description><![CDATA[Hackers often change the content type of their uploads, which could be malicious files. Here is how to guard against this.&nbsp;&nbsp;<a href="http://www.eggheadcafe.com/sample-code/ASP.NET/65197f4f-24ec-4fff-a44f-9747635dce51/how-to-determine-if-an-uploaded-image-is-valid.aspx" target="_self">read more</a>]]></description><pubDate>Sat, 02 Jul 2011 12:40:46 GMT</pubDate></item><item><title><![CDATA[How to Disable ASP.NET Submit button after first Submit]]></title><guid isPermaLink="true"><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/0f1716fd-bcfa-45c3-afb6-a365a20a9de3/how-to-disable-aspnet-submit-button-after-first-submit.aspx]]></guid><link><![CDATA[http://www.eggheadcafe.com/sample-code/ASP.NET/0f1716fd-bcfa-45c3-afb6-a365a20a9de3/how-to-disable-aspnet-submit-button-after-first-submit.aspx]]></link><description><![CDATA[If you have a form (for payment, etc) and you want to prevent multiple form submissions there are several techniques you can use.&nbsp;&nbsp;<a href="http://www.eggheadcafe.com/sample-code/ASP.NET/0f1716fd-bcfa-45c3-afb6-a365a20a9de3/how-to-disable-aspnet-submit-button-after-first-submit.aspx" target="_self">read more</a>]]></description><pubDate>Fri, 17 Jun 2011 13:57:14 GMT</pubDate></item></channel></rss>