<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Israel Aéce</title><link>http://weblogs.asp.net/israelaece/default.aspx</link><description>Microsoft MVP, MCP, MCAD, MCTS, MCPD and MCT</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Differences between WPF and XBAP</title><link>http://weblogs.asp.net/israelaece/archive/2007/01/29/differences-between-wpf-and-xbap.aspx</link><pubDate>Tue, 30 Jan 2007 02:16:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:1494021</guid><dc:creator>israel aece</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/israelaece/rsscomments.aspx?PostID=1494021</wfw:commentRss><comments>http://weblogs.asp.net/israelaece/archive/2007/01/29/differences-between-wpf-and-xbap.aspx#comments</comments><description>&lt;a href="http://wpfwonderland.wordpress.com/2007/01/28/comparing-wpf-applications-and-xbap-whats-the-difference/"&gt;Here is a very nice list&lt;/a&gt; with the main differences between WPF and XBAP.&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=1494021" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/israelaece/archive/tags/WPF/default.aspx">WPF</category></item><item><title>Contract between ASPX and ASCX</title><link>http://weblogs.asp.net/israelaece/archive/2007/01/05/contract-between-aspx-and-ascx.aspx</link><pubDate>Fri, 05 Jan 2007 23:31:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:1368555</guid><dc:creator>israel aece</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/israelaece/rsscomments.aspx?PostID=1368555</wfw:commentRss><comments>http://weblogs.asp.net/israelaece/archive/2007/01/05/contract-between-aspx-and-ascx.aspx#comments</comments><description>&lt;p&gt;Contract between ASPX and ASCX&lt;/p&gt;&lt;p align="justify"&gt;In the last versions of ASP.NET where not exist the compilation equals ASP.NET 2.0, easily we can invoke an ASPX method inside an User Control (ASCX), casting Page property to a Page type that would be a container but, this can cause a problem when an ASPX not provides a respective method.&lt;/p&gt;&lt;p align="justify"&gt;With a new compilation in ASP.NET 2.0, it&amp;#39;s dificult casting to a Page type because the name is resolved in compilation-time, so, in design-time we don&amp;#39;t know this type. If you aren&amp;#39;t using the &lt;a href="http://webproject.scottgu.com/"&gt;Web Application Project&lt;/a&gt; (WAP) and want invoke a Page&amp;#39;s method, you will need to create a contract through Interface. This Interface should be only implemented in ASPX where you want the User Control invoke a method. Below is an example:&lt;/p&gt;&lt;p&gt;public interface IConnection&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void ExecuteProcedure();&lt;br /&gt;}&lt;/p&gt;&lt;p&gt;public partial class _Default : System.Web.UI.Page, &lt;strong&gt;IConnection&lt;/strong&gt;&lt;br /&gt;public partial class Default2 : System.Web.UI.Page&lt;/p&gt;&lt;p&gt;&lt;strong&gt;[ ASCX ]&lt;/strong&gt;&lt;br /&gt;IConnection connection = this.Page as IConnection;&lt;br /&gt;if (connection != null)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; connection.ExecuteProcedure();&lt;br /&gt;else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Write(&amp;quot;The Page container isn&amp;#39;t a IConnection type!&amp;quot;);&lt;/p&gt;&lt;p align="justify"&gt;How you can note, the Default.aspx Page implements a Interface IConnection and Default2.aspx doesn&amp;#39;t. Finally, inside an User Control, casting the Page Property to IConnection through as operator that, if isn&amp;#39;t a compatible type, it will return null. If you have been using Visual Basic 2005, use the TryCast operator instead.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=1368555" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/israelaece/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>WTF!</title><link>http://weblogs.asp.net/israelaece/archive/2006/12/12/wtf.aspx</link><pubDate>Tue, 12 Dec 2006 11:08:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:1218664</guid><dc:creator>israel aece</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/israelaece/rsscomments.aspx?PostID=1218664</wfw:commentRss><comments>http://weblogs.asp.net/israelaece/archive/2006/12/12/wtf.aspx#comments</comments><description>A typical WTF :)&lt;br /&gt;&lt;br /&gt;Public Sub New(ByVal str As String)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If (str = String.Empty Or str = Nothing Or String.IsNullOrEmpty(str) Or Len(str) = 0) Then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; str = &amp;quot;&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me._str = str&lt;br /&gt;End Sub &lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=1218664" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/israelaece/archive/tags/WTF/default.aspx">WTF</category></item><item><title>WPF/E</title><link>http://weblogs.asp.net/israelaece/archive/2006/12/07/wpf-e.aspx</link><pubDate>Thu, 07 Dec 2006 21:51:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:1187991</guid><dc:creator>israel aece</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/israelaece/rsscomments.aspx?PostID=1187991</wfw:commentRss><comments>http://weblogs.asp.net/israelaece/archive/2006/12/07/wpf-e.aspx#comments</comments><description>&lt;p align="justify"&gt;Reading my blog list, I &lt;a href="http://blogs.conchango.com/johnrayner/archive/2006/12/05/WPF_2F00_E_3A00_-Setting-up-your-workstation.aspx"&gt;found a great post&lt;/a&gt; where the author show how to install Visual Studio .NET 2005 templates for WPF/E. Look the installation details, because it requires additional add-ins.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=1187991" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/israelaece/archive/tags/WPF/default.aspx">WPF</category></item><item><title>HTTP Pipeline - Performance</title><link>http://weblogs.asp.net/israelaece/archive/2006/11/21/http-pipeline-performance.aspx</link><pubDate>Wed, 22 Nov 2006 01:01:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:985439</guid><dc:creator>israel aece</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/israelaece/rsscomments.aspx?PostID=985439</wfw:commentRss><comments>http://weblogs.asp.net/israelaece/archive/2006/11/21/http-pipeline-performance.aspx#comments</comments><description>&lt;p align="justify"&gt;Finishing reading&amp;nbsp;the &lt;a href="http://msmvps.com/blogs/luisabreu/default.aspx"&gt;Luis Abreu&amp;acute;s&lt;/a&gt; &lt;a href="http://www.livrariacultura.com.br/scripts/cultura/catalogo/busca.asp?parceiro=TPAOOA&amp;amp;nautor=705095&amp;amp;neditora=&amp;amp;n1=&amp;amp;n2=&amp;amp;n3=&amp;amp;palavratitulo=&amp;amp;palavraautor=&amp;amp;palavraeditora=&amp;amp;palavraassunto=&amp;amp;modobuscatitulo=pc&amp;amp;modobuscaautor=pc&amp;amp;precomax=0&amp;amp;cidioma=&amp;amp;refino=1&amp;amp;sid=246148134821849658404625&amp;amp;k5=2C64C607&amp;amp;uid="&gt;book&lt;/a&gt;, in last chapter he speaks about the page life-cycle and I remembered of performance detail that we can use in ASP.NET applications around HttpModules and I implemented it&amp;nbsp;in &lt;a href="http://www.projetando.net"&gt;Projetando.NET&lt;/a&gt; website.&lt;br /&gt;&lt;br /&gt;In machine.config file there is a section called &lt;em&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/9b9dh535.aspx"&gt;httpModules&lt;/a&gt;&lt;/em&gt; where we have several modules that, for default, are related and will be performed during request; here is some examples: &lt;em&gt;OutputCache&lt;/em&gt;, &lt;em&gt;Session&lt;/em&gt;, &lt;em&gt;FormsAuthentication&lt;/em&gt;, etc. But, in some applications, these modules aren&amp;#39;t used and, in this case, we can remove them of the application through the following Web.Config configuration:&lt;br /&gt;&lt;br /&gt;&amp;lt;httpModules&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;remove name=&amp;quot;Session&amp;quot; /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;remove name=&amp;quot;WindowsAuthentication&amp;quot; /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;remove name=&amp;quot;FormsAuthentication&amp;quot; /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;remove name=&amp;quot;PassportAuthentication&amp;quot; /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;remove name=&amp;quot;UrlAuthorization&amp;quot; /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;remove name=&amp;quot;FileAuthorization&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;/httpModules&amp;gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=985439" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/israelaece/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>System.Collections.Generic.HashSet</title><link>http://weblogs.asp.net/israelaece/archive/2006/11/10/System.Collections.Generic.HashSet.aspx</link><pubDate>Fri, 10 Nov 2006 11:48:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:900671</guid><dc:creator>israel aece</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/israelaece/rsscomments.aspx?PostID=900671</wfw:commentRss><comments>http://weblogs.asp.net/israelaece/archive/2006/11/10/System.Collections.Generic.HashSet.aspx#comments</comments><description>&lt;p&gt;The BCL Team work in a new type collection called (temporary) &lt;a href="http://blogs.msdn.com/bclteam/archive/2006/11/09/introducing-hashset-t-kim-hamilton.aspx"&gt;HashSet&lt;/a&gt; that is a collection containing unique elements. Your own &lt;em&gt;Add&lt;/em&gt; method returns a boolean value indicating if item was added or not.&lt;/p&gt;&lt;p&gt;While we haven&amp;#39;t this collection, you can use Wintellect&amp;#39;s &lt;a href="http://www.wintellect.com/PowerCollections/Docs/Wintellect.PowerCollections.Set`1.html"&gt;PowerCollections.Set&amp;lt;T&amp;gt;&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=900671" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/israelaece/archive/tags/.NET/default.aspx">.NET</category></item><item><title>Checking authorization through roles</title><link>http://weblogs.asp.net/israelaece/archive/2006/10/31/Checking-authorization-through-roles.aspx</link><pubDate>Tue, 31 Oct 2006 10:22:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:769054</guid><dc:creator>israel aece</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/israelaece/rsscomments.aspx?PostID=769054</wfw:commentRss><comments>http://weblogs.asp.net/israelaece/archive/2006/10/31/Checking-authorization-through-roles.aspx#comments</comments><description>&lt;p align="justify"&gt;In ASP.NET application or any application, is common to verify if the user has permission for a resource, like page, button, command, etc. In last days, I received an e-mail where a guy had performance problems.&lt;br /&gt;&lt;br /&gt;In his page, there is a delete button in each line of GridView control. So, in &lt;a href="http://msdn2.microsoft.com/en-gb/library/system.web.ui.webcontrols.gridview.rowdatabound.aspx"&gt;RowDataBound&lt;/a&gt; event, he checks if the current user is in a specific role or not. But the problem is that he calls the &lt;a href="http://msdn2.microsoft.com/en-us/library/4z6b5d42.aspx"&gt;IsUserInRole&lt;/a&gt; method for each line/record. In hundreds of lines/records in GridView, this method will always be called and, for each call, all code in this method will be performed. The example is showed below:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;[ The old RowDataBound event ]&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;if(e.Row.RowType == DataControlRowType.DataRow) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.Row.FindControl(&amp;ldquo;btnDelete&amp;rdquo;).Visible = Roles.IsUserInRole(&amp;ldquo;Administrator&amp;rdquo;);&lt;br /&gt;}&lt;/p&gt;&lt;p&gt;&lt;strong&gt;[ The new RowDataBound event ]&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;private bool _isInAdministratorRole;&lt;br /&gt;//&amp;hellip;.&lt;br /&gt;this._isInAdministratorRole = Roles.IsUserInRole(&amp;ldquo;Administrator&amp;rdquo;);&lt;br /&gt;//&amp;hellip;.&lt;br /&gt;if(e.Row.RowType == DataControlRowType.DataRow) {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; e.Row.FindControl(&amp;ldquo;btnDelete&amp;rdquo;).Visible = this._isInAdministratorRole;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Small techniques like this can improve the application performance. &amp;ldquo;Caching code&amp;rdquo; is explained in Code &lt;a href="http://cc2e.com/"&gt;Complete Book - Second Edition&lt;/a&gt;, at Chapter 26, pages 628 and 629.&lt;br /&gt;&lt;br /&gt;There are other techniques related with roles in ASP.NET WebApplication. These techniques allow role caching in client cookies through &lt;a href="http://msdn2.microsoft.com/en-US/library/system.web.security.roles.cacherolesincookie.aspx"&gt;cacheRolesInCookie&lt;/a&gt; attribute. It prevents in each request, to make a new query in database (or other repository), to find specific roles for current logged user and attach in &lt;a href="http://msdn2.microsoft.com/en-us/library/system.web.httpcontext.aspx"&gt;HttpContext&lt;/a&gt; object.&lt;br /&gt;&lt;br /&gt;Caching roles in client-side cookies can improve the performance if your application has a slow data access or a large number of roles. But this technique has security problems and you need to be careful:&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Persistent authorization cookies will be stored in a user&amp;#39;s profile and can be stolen if an attacker gets physical access to the machine. This will also help prevent problems for users who access your application from public or shared machines and forget to log out.&lt;/li&gt;&lt;li&gt;Sending cookies out exclusively over SSL makes it much harder for an attacker to sniff the cookie values off the wire.&amp;nbsp; If an attacker can get a copy of an authorization cookie, they can potentially emulate that role, allowing them to elevate their privilege in the system.&lt;/li&gt;&lt;/ol&gt;&lt;p align="justify"&gt;If caching of roles in client-side is necessary, so enable the &lt;a href="http://msdn2.microsoft.com/en-gb/library/system.web.security.roles.cookierequiressl.aspx"&gt;cookieRequireSSL&lt;/a&gt; attribute in &lt;a href="http://msdn2.microsoft.com/en-us/library/ms164661.aspx"&gt;roleManager&lt;/a&gt; element for security reasons. But, SSL requires a certificate (if you don&amp;rsquo;t have, it&amp;rsquo;s necessary to buy it) and performance can be harmed. It&amp;rsquo;s very important to analyze the scenario and adopt the better strategy.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=769054" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/israelaece/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Changing the Web.Config's connectionstring section</title><link>http://weblogs.asp.net/israelaece/archive/2006/09/26/Changing-the-Web.Config_2700_s-connectionstring-section.aspx</link><pubDate>Tue, 26 Sep 2006 11:50:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:583583</guid><dc:creator>israel aece</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/israelaece/rsscomments.aspx?PostID=583583</wfw:commentRss><comments>http://weblogs.asp.net/israelaece/archive/2006/09/26/Changing-the-Web.Config_2700_s-connectionstring-section.aspx#comments</comments><description>&lt;p align="justify"&gt;Many people ask me how they can change or add a new connectionstring in Web.Config&amp;#39;s connectionstring section. Basically you only need import the System.Web.Configuration namespace, open the Web.Config file where is connectionstrings section and change or add a new connectionstring. An example is:&lt;/p&gt;&lt;p&gt;Configuration webConfig = WebConfigurationManager.OpenWebConfiguration(&amp;quot;~&amp;quot;);&lt;br /&gt;ConnectionStringsSection dbConnString = webConfig.ConnectionStrings;&lt;/p&gt;&lt;p&gt;//Changing&lt;br /&gt;dbConnString.ConnectionStrings[&amp;quot;DBOrders&amp;quot;].ConnectionString = &amp;quot;YOUR NEW CONNSTRING HERE&amp;quot;;&lt;/p&gt;&lt;p&gt;//Adding&lt;br /&gt;dbConnString.ConnectionStrings.Add(&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; new ConnectionStringSettings(&amp;quot;MDBTest&amp;quot;, &amp;quot;MDB ConnString&amp;quot;, &amp;quot;System.Data.OleDb&amp;quot;));&lt;/p&gt;&lt;p&gt;webConfig.Save();&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=583583" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/israelaece/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Client-Side Callbacks and Exceptions</title><link>http://weblogs.asp.net/israelaece/archive/2006/09/01/Client_2D00_Side-Callbacks-and-Exceptions.aspx</link><pubDate>Fri, 01 Sep 2006 17:16:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:510891</guid><dc:creator>israel aece</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/israelaece/rsscomments.aspx?PostID=510891</wfw:commentRss><comments>http://weblogs.asp.net/israelaece/archive/2006/09/01/Client_2D00_Side-Callbacks-and-Exceptions.aspx#comments</comments><description>&lt;p align="justify"&gt;Those that already worked with &lt;a href="http://www.projetando.net/Sections/ViewArticle.aspx?ArticleID=56"&gt;Client-Side Callbacks&lt;/a&gt; know that when add the reference in control client events; we can to define an error client function that will be gone off if the server-side method throws an exception.&lt;/p&gt;&lt;p align="justify"&gt;So, there is a problem in this scene: if the server-side method throws an exception and the &lt;em&gt;mode&lt;/em&gt; attribute of &lt;em&gt;customErrors&lt;/em&gt; section will be with &lt;em&gt;On&lt;/em&gt; or &lt;em&gt;RemoteOnly&lt;/em&gt; (this is default), your callback never work correctly and the following message will pass as argument for the error client function:&lt;/p&gt;&lt;p&gt;&lt;em&gt;&lt;font color="#ff0000"&gt;There was an error in the callback.&lt;/font&gt;&lt;/em&gt;&lt;/p&gt;&lt;p align="justify"&gt;This error occurs when an exception is throwing, the page is changed and &lt;em&gt;customErrors&lt;/em&gt; intercept the process, so the above message is returned for client instead Exception message.&lt;/p&gt;&lt;p align="justify"&gt;If you define the &lt;em&gt;customErrors&lt;/em&gt; as &lt;em&gt;Off&lt;/em&gt;, the process will work, but depending of your error handling strategy, this configuration will be able to disclose important details about the error, because it displays for all clients. To resolve this, maybe it&amp;rsquo;s necessary isolate the page that use the callback in a different directory, add a new Web.Config file, override the &lt;em&gt;customErrors&lt;/em&gt; section to &lt;em&gt;Off&lt;/em&gt; and involve page&amp;rsquo;s code in Try.Catch.Finally statement.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=510891" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/israelaece/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item><item><title>Server.Transfer is limited?</title><link>http://weblogs.asp.net/israelaece/archive/2006/07/26/Server.Transfer-is-limited_3F00_.aspx</link><pubDate>Wed, 26 Jul 2006 19:22:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:460663</guid><dc:creator>israel aece</dc:creator><slash:comments>10</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://weblogs.asp.net/israelaece/rsscomments.aspx?PostID=460663</wfw:commentRss><comments>http://weblogs.asp.net/israelaece/archive/2006/07/26/Server.Transfer-is-limited_3F00_.aspx#comments</comments><description>&lt;p align="justify"&gt;I&amp;#39;m working at ASP.NET Web Application project and I created a &lt;em&gt;handler&lt;/em&gt;, that obviously implement an &lt;a href="http://msdn2.microsoft.com/fr-fr/library/system.web.ihttphandler.aspx"&gt;IHttpHandler&lt;/a&gt; Interface, for process and generate a binary file to force a download it.&lt;br /&gt;&lt;br /&gt;After config the Web.Config file, the request for &amp;quot;*.abc&amp;quot; file extension will be now intercepted for this &lt;em&gt;handler&lt;/em&gt;. But, there is a big problem here, because I&amp;#39;m using the &lt;a href="http://msdn2.microsoft.com/en-us/library/system.web.httpserverutility.transfer.aspx"&gt;Server.Transfer&lt;/a&gt; method, so I cannot send a &lt;em&gt;handler&lt;/em&gt; instance &lt;a href="http://msdn2.microsoft.com/en-us/library/8z9e2zxx.aspx"&gt;for overload of this method&lt;/a&gt; or call the &amp;quot;virtual path&amp;quot; directly, like &amp;quot;Page.abc&amp;quot;. You can confirm this information decompiling the Transfer method using the Reflector tool:&lt;br /&gt;&lt;br /&gt;&lt;font color="#006400"&gt;[ --- Supress --- ]&lt;br /&gt;&lt;/font&gt;&lt;font color="#0000ff"&gt;else if&lt;/font&gt; (!(handler &lt;font color="#0000ff"&gt;is&lt;/font&gt; Page))&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; error = &lt;font color="#0000ff"&gt;new&lt;/font&gt; HttpException(0x194, &lt;font color="#0000ff"&gt;string&lt;/font&gt;.Empty);&lt;br /&gt;}&lt;br /&gt;&lt;font color="#006400"&gt;[ --- Supress --- ]&lt;/font&gt;&lt;br /&gt;&lt;font color="#0000ff"&gt;if&lt;/font&gt; (error != &lt;font color="#0000ff"&gt;null&lt;/font&gt;)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;font color="#006400"&gt;[ --- Supress --- ]&lt;/font&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;font color="#0000ff"&gt;throw new&lt;/font&gt; HttpException(SR.GetString(&amp;quot;Error_executing_child_request_for_handler&amp;quot;, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;font color="#0000ff"&gt;new&lt;/font&gt; object[] { handler.GetType().ToString() }), error);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Independently of Transfer method overload that you use, the error message is the same: &lt;font color="#ff0000"&gt;&amp;quot;Error executing child request for [handler | Page.abc].&amp;quot;&lt;/font&gt;. So, the reason&amp;nbsp;why I cannot use the Response.Redirect is that I need to send parameters through Context.Items collection for security intentions.&lt;br /&gt;&lt;br /&gt;The temporary solution is to inherit the &lt;a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.page.aspx"&gt;Page&lt;/a&gt; class instead implements IHttpHandler Interface in my &lt;em&gt;handler&lt;/em&gt;, but I believe that &amp;quot;solution&amp;quot; isn&amp;#39;t elegant.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=460663" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/israelaece/archive/tags/ASP.NET/default.aspx">ASP.NET</category></item></channel></rss>