<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>ASP.NET</title><link>http://www.michaelfalconer.co.uk/category/4.aspx</link><description>ASP.NET</description><managingEditor>Michael Falconer</managingEditor><dc:language>en-GB</dc:language><generator>.Text Version 0.95.2004.102</generator><item><dc:creator>Michael Falconer</dc:creator><title>Threat Modeling Web Applications</title><link>http://www.michaelfalconer.co.uk/archive/2005/05/18/227.aspx</link><pubDate>Wed, 18 May 2005 13:28:00 GMT</pubDate><guid>http://www.michaelfalconer.co.uk/archive/2005/05/18/227.aspx</guid><description>&lt;P&gt;Well, felt it was finally time to start posting again. I've been working on quite a few interesting applications over the past few months, so I hope to add some useful posts soon.&lt;/P&gt;
&lt;P&gt;In the meantime there's an &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnpag2/html/tmwa.asp"&gt;interesting new series of posts&lt;/A&gt; on &lt;A title="Microsoft Developer Network" href="http://msdn.microsoft.com" target=_blank&gt;MSDN&lt;/A&gt; about developing threat models for web applications. While you may be aware of most of the threats, and the steps to prevent them becoming attacks, it's always good to review your knowledge, and to read about formalising the processes you hopefully already go through.&lt;/P&gt;&lt;img src ="http://www.michaelfalconer.co.uk/aggbug/227.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Michael Falconer</dc:creator><title>ViewStateUserKey</title><link>http://www.michaelfalconer.co.uk/archive/2005/02/13/220.aspx</link><pubDate>Sun, 13 Feb 2005 12:04:00 GMT</pubDate><guid>http://www.michaelfalconer.co.uk/archive/2005/02/13/220.aspx</guid><description>&lt;P&gt;While reading through an article titled '&lt;A href="http://msdn.microsoft.com/asp.net/default.aspx?pull=/library/en-us/dnaspp/html/securitybarriers.asp"&gt;Take Advantage of &lt;a title="ASP.NET" href="http://www.asp.net" target="_blank"&gt;ASP.NET&lt;/a&gt; Built-in Features to Fend Off Web Attacks&lt;/A&gt;' on &lt;a title="Microsoft Developer Network" href="http://msdn.microsoft.com" target="_blank"&gt;MSDN&lt;/a&gt; recently, I came across a new property for the Page class I'd never noticed before: ViewStateUserKey. The documentation for this property states:&lt;/P&gt;
&lt;BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px"&gt;
&lt;P&gt;Assigns an identifier to an individual user in the view state variable associated with the current page&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;It turns out what this can be used for is to add a user specific string to the ViewState of a Page which can be verified on PostBack. Why? This means you can be sure that any form information submitted came from the same user who requested the original page, thus preventing one-click attacks.&lt;/P&gt;
&lt;P&gt;I highly recommend you read &lt;A href="http://msdn.microsoft.com/asp.net/default.aspx?pull=/library/en-us/dnaspp/html/securitybarriers.asp"&gt;the article above&lt;/A&gt;&amp;nbsp;for more information, and for techniques to prevent other common attacks...&lt;/P&gt;&lt;img src ="http://www.michaelfalconer.co.uk/aggbug/220.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Michael Falconer</dc:creator><title>New site - journalonline.co.uk</title><link>http://www.michaelfalconer.co.uk/archive/2004/10/25/205.aspx</link><pubDate>Mon, 25 Oct 2004 12:07:00 GMT</pubDate><guid>http://www.michaelfalconer.co.uk/archive/2004/10/25/205.aspx</guid><description>&lt;P&gt;Last week a site I've been working on for a couple of months went live - &lt;A href="http://www.journalonline.co.uk"&gt;www.journalonline.co.uk&lt;/A&gt;. Developed for the &lt;A href="http://www.lawscot.org.uk"&gt;Law Society of Scotland&lt;/A&gt; and working with &lt;A href="http://www.connectcommunications.co.uk"&gt;Connect Communications&lt;/A&gt;, the site is an online resource of information that appears in the printed magazine 'The Journal'.&lt;/P&gt;
&lt;P&gt;The site is entirely developed in &lt;A title=ASP.NET href="http://www.asp.net" target=_blank&gt;ASP.NET&lt;/A&gt; (using c#) and has a SQL Server 2000 backend. I made use of &lt;A href="http://www.wilsondotnet.com"&gt;Paul Wilson's&lt;/A&gt; &lt;A href="http://authors.aspalliance.com/PaulWilson/Articles/?id=14"&gt;master pages&lt;/A&gt; for maintaining the site templates, and also used the Data Provider and &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnbda/html/cmab.asp"&gt;Configuration Management&lt;/A&gt; application blocks. Note that if you plan to use the Configuration Management application blosk, I strongly recommend you check out the forum on the gotdotnet site where the component is hosted - there are a number of known issues with it.&lt;/P&gt;
&lt;P&gt;The search facility provided on the site (to search the library of articles) makes use of a Full Text Index. Having used Index Server a number of times in the past to provide search facilities,&amp;nbsp;I understood the ease of integration this approach would offer, and the in built facility for ranking results. It was also a low cost solution, as no third party software was required. The main downside can be the performance of the index population, but in this case that wasn't an issue as the frequency of updates was low.&lt;/P&gt;
&lt;P&gt;The backend of the system also uses &lt;A href="http://www.freetextbox.com"&gt;FreeTextBox&lt;/A&gt; (the same component used to manage this blog!).&lt;/P&gt;
&lt;P&gt;Feel free to have a look and let me know what you think!&lt;/P&gt;&lt;img src ="http://www.michaelfalconer.co.uk/aggbug/205.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Michael Falconer</dc:creator><title>ASP.NET security vulnerability</title><link>http://www.michaelfalconer.co.uk/archive/2004/10/07/204.aspx</link><pubDate>Thu, 07 Oct 2004 10:57:00 GMT</pubDate><guid>http://www.michaelfalconer.co.uk/archive/2004/10/07/204.aspx</guid><description>&lt;P&gt;As everyone by now hopefully knows, there is a &lt;A href="http://www.microsoft.com/security/incident/aspnet.mspx"&gt;vulnerability in &lt;a title="ASP.NET" href="http://www.asp.net" target="_blank"&gt;ASP.NET&lt;/a&gt;&lt;/A&gt; that could allow an attacker to bypass security and access secured content.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://support.microsoft.com/?kbid=887459"&gt;The fix&lt;/A&gt; is relatively straightforward, and there will hopefully be a proper patch from MS soon...&lt;/P&gt;&lt;img src ="http://www.michaelfalconer.co.uk/aggbug/204.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Michael Falconer</dc:creator><title>Accessing current HttpContext from a static method</title><link>http://www.michaelfalconer.co.uk/archive/2004/08/29/197.aspx</link><pubDate>Sun, 29 Aug 2004 10:49:00 GMT</pubDate><guid>http://www.michaelfalconer.co.uk/archive/2004/08/29/197.aspx</guid><description>&lt;P&gt;I was writing a class to hadle the caching of objects for the &lt;A title=ASP.NET href="http://www.asp.net" target=_blank&gt;ASP.NET&lt;/A&gt; application I'm currently developing, and suddenly wondered if I could access the current HttpContext from within a static method. The answer, of course, is yes..&lt;/P&gt;
&lt;P&gt;System.Web.HttpContext context = System.Web.HttpContext.Current&lt;/P&gt;
&lt;P&gt;Another &lt;A href="http://www.dotnet247.com/247reference/msgs/23/116600.aspx" target=_blank&gt;quick and easy answer&lt;/A&gt; thanks to &lt;A title=".NET 247" href="http://www.dotnet247.com" target=_blank&gt;.NET 247&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&lt;FONT color=#ff0000&gt;UPDATE&lt;/FONT&gt;: Thanks to &lt;A href=http://www.mostlylucid.co.uk target="_blank"&gt;Scott&lt;/A&gt; (see comments below) for pointing out you can also access the Cache directly via the HttpRuntime class, without requiring a context.&lt;/P&gt;&lt;img src ="http://www.michaelfalconer.co.uk/aggbug/197.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Michael D. Falconer</dc:creator><title>Caching features in ASP.NET 2.0</title><link>http://www.michaelfalconer.co.uk/archive/2004/07/05/188.aspx</link><pubDate>Mon, 05 Jul 2004 10:13:00 GMT</pubDate><guid>http://www.michaelfalconer.co.uk/archive/2004/07/05/188.aspx</guid><description>&lt;P&gt;If you've not already had a chance to read Stephen Walther's article on &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/CachingNT2.asp" target=_blank&gt;Improved Caching in ASP.NET 2.0&lt;/A&gt;, I'd highly recommend you do so now. I've been looking forward to the billed SQL Cache features added to ASP.NET 2.0, but what really caught my eye was right at the end of the article. Namely post-cache substitution.&lt;/P&gt;
&lt;P&gt;I've already been in situations where I'd love to cache the main part of a page, but just want a single user control to be dynamic (i.e. not cached). For examlpe, many sites include&amp;nbsp;a user control to allow members to log-on, and when they do the panel contents change to show user specific information. In some cases you might want to cache the page contents, but what if the user then uses the panel to log-on? You can't use the cached version of the page...&lt;/P&gt;
&lt;P&gt;Thankfully ASP.NET 2.0 introduces a new Substitution control. This allows you include dynamic content in a cached page. I'd highly recommend looknig at the example in the article above, or in &lt;A href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs05/html/aspnetwhidbey_caching.asp" target=_blank&gt;Caching Improvements in ASP.NET Whidbey&lt;/A&gt;&amp;nbsp;by G. Andrew Duthie. You can also read the BETA documentation for the &lt;A href="http://lab.msdn.microsoft.com/library/en-us/cpref/html/T_System_Web_UI_WebControls_Substitution.asp?frame=true" target=_blank&gt;Substitution Class&lt;/A&gt;.&lt;/P&gt;[&lt;FONT color=#ff0000&gt;UPDATE&lt;/FONT&gt;] - Looks like the first article has disappeared! I'll re-link to it when it appears again...&lt;img src ="http://www.michaelfalconer.co.uk/aggbug/188.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Michael D. Falconer</dc:creator><title>Handling postbacks in composite web controls</title><link>http://www.michaelfalconer.co.uk/archive/2004/06/07/177.aspx</link><pubDate>Mon, 07 Jun 2004 12:20:00 GMT</pubDate><guid>http://www.michaelfalconer.co.uk/archive/2004/06/07/177.aspx</guid><description>&lt;P&gt;I've been developing a composite web control lately to provide numeric paging for a web form. One problem I hit was how to change the structure of the child controls after handling a postback event. The typical order of events for a composite control is:&lt;/P&gt;
&lt;P&gt;Load -&amp;gt; CreateChildControls -&amp;gt; Handle Postback -&amp;gt; Render&lt;/P&gt;
&lt;P&gt;I was dynamically creating some of the child controls based on fields that could be modified by the Postback events. The problem was, as you can see from the order above, the child controls&amp;nbsp;are created before&amp;nbsp;the fields are set.&lt;/P&gt;
&lt;P&gt;Thankfully I found&amp;nbsp;&lt;A href="http://www.dotnet247.com/247reference/msgs/40/200707.aspx" target=_blank&gt;this post&lt;/A&gt; on &lt;A href=http://www.dotnet247.com target="_blank"&gt;.NET 247&lt;/A&gt; by Arthur Mnev. He had exactly the same problem and had found a neat solution. If you set the controls ChildControlsCerated flag to False&amp;nbsp;in the event handler, the .net framework will then regenerate the child controls after the event handler has completed. It does incur a penalty as the CreateChildControls method is run twice, but it works very nicely. As he points out you do have to make sure the that the controls are created is the correct order the first tmie the code runs, but in most cases this will not be an issue.&lt;/P&gt;
&lt;P&gt;To get round the double running of the code, he does mention that he 'changed it to redirect itself to its own page with Get Parameters instead of events'. Something else for me to take a look at soon...!&lt;/P&gt;&lt;img src ="http://www.michaelfalconer.co.uk/aggbug/177.aspx" width = "1" height = "1" /&gt;</description></item><item><dc:creator>Michael D. Falconer</dc:creator><title>Rob Howard : Farewell and Teched slides</title><link>http://www.michaelfalconer.co.uk/archive/2004/06/01/173.aspx</link><pubDate>Tue, 01 Jun 2004 13:02:00 GMT</pubDate><guid>http://www.michaelfalconer.co.uk/archive/2004/06/01/173.aspx</guid><description>&lt;A href="http://weblogs.asp.net/rhoward" target="_blank"&gt;Rob Howard &lt;/A&gt;has &lt;A href="http://weblogs.asp.net/rhoward/archive/2004/05/28/143830.aspx" target="_blank"&gt;announced&lt;/A&gt; that he's leaving Microsoft, but has thankfully posted up &lt;A href="http://weblogs.asp.net/rhoward/archive/2004/05/28/143830.aspx" target="_blank"&gt;slides from some TechEd US presentations&lt;/A&gt;. I've just had a flick through the presentation titled 'Running www.asp.net', and it looks very interesting. There's certainly a nice list of recommendations to follow.&lt;img src ="http://www.michaelfalconer.co.uk/aggbug/173.aspx" width = "1" height = "1" /&gt;</description></item></channel></rss>