<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://forums.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>ASP.NET MVC</title><link>http://forums.asp.net/1146.aspx</link><description>Discussions regarding Model-View-Controller (MVC) support in ASP.NET.  &lt;a href="http://forums.asp.net/1215.aspx"&gt;T4MVC subforum&lt;/a&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Re: BUG: Order of opperations in Action parameter validation seems wrong.</title><link>http://forums.asp.net/thread/2243768.aspx</link><pubDate>Wed, 19 Mar 2008 21:56:31 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2243768</guid><dc:creator>nberardi</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2243768.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=2243768</wfw:commentRss><description>&lt;p&gt;&lt;BLOCKQUOTE&gt;&lt;div&gt;&lt;img src="/Themes/fan/images/icon-quote.gif"&gt; &lt;strong&gt;tgmdbm:&lt;/strong&gt;&lt;/div&gt;&lt;div&gt;However, from the code that he refers to, it seems to be setting it to either true or false and letting the action handle it, so it&amp;#39;s less of a Captcha&lt;b&gt;Validation&lt;/b&gt; and more or a Captcha&lt;b&gt;Reader&lt;/b&gt; or something like that. (not happy with &amp;quot;reader&amp;quot;, naming is that hardest part of computer science)&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;How about CaptchaVerification.&amp;nbsp; I am with you good naming is probably the hardest part of Computer Science.&lt;/p&gt;&lt;p&gt;Well I originally stumbled on to this possibility when I was using the previous version of MVC.&amp;nbsp; It worked in that version, that is why I thought it was a bug. Because the ability was removed.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;The decorating of the Action Method, with the attribute, seemed like such a natural way to encapsulate an operation that I was going to need to do for specific forms.&amp;nbsp; And honestly I didn&amp;#39;t really care about the process, or the random text from the CAPTCHA that was being posted back, all I cared about was the outcome or the verification of the CAPTCHA text.&amp;nbsp; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;I really hope you can intigrate this in to the next refresh.&lt;br /&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: BUG: Order of opperations in Action parameter validation seems wrong.</title><link>http://forums.asp.net/thread/2241812.aspx</link><pubDate>Wed, 19 Mar 2008 06:51:20 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2241812</guid><dc:creator>Haacked</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2241812.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=2241812</wfw:commentRss><description>&lt;p&gt;Nice idea. We are definitely looking into this. I think this makes sense for example if I wrote an action filter that logs errors, I would want it to run even if calling the action failed.&lt;/p&gt;</description></item><item><title>Re: BUG: Order of opperations in Action parameter validation seems wrong.</title><link>http://forums.asp.net/thread/2239500.aspx</link><pubDate>Tue, 18 Mar 2008 09:32:44 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2239500</guid><dc:creator>tgmdbm</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2239500.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=2239500</wfw:commentRss><description>&lt;p&gt;I can&amp;#39;t speak for nberardi but I don&amp;#39;t see that as important.&lt;/p&gt;&lt;p&gt;If in his example, captchaValid doesn&amp;#39;t mean anything to the Login
action, then the obvious solution is just to remove the argument. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;However, from the code that he refers to, it seems to be setting it to either true or false and letting the action handle it, so it&amp;#39;s less of a Captcha&lt;b&gt;Validation&lt;/b&gt; and more or a Captcha&lt;b&gt;Reader&lt;/b&gt; or something like that. (not happy with &amp;quot;reader&amp;quot;, naming is that hardest part of computer science)&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Even if that&amp;#39;s not the case, the feature is still a great idea!. You can use it to do your own string &amp;gt; object deserialization, add per-action default route parameters, dependency injection. There&amp;#39;s a wealth of opportunity here that i&amp;#39;m sure people will take advantage of.&lt;br /&gt;&lt;/p&gt;</description></item><item><title>Re: BUG: Order of opperations in Action parameter validation seems wrong.</title><link>http://forums.asp.net/thread/2239414.aspx</link><pubDate>Tue, 18 Mar 2008 08:57:59 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2239414</guid><dc:creator>levib</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2239414.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=2239414</wfw:commentRss><description>&lt;p&gt;Just out of curiosity, assuming that the functionality you request is implemented, what would the Login() action do if captchaValid is false?&amp;nbsp; And is this result most logically associated with the CaptchaValidation filter or with the Login() method?&amp;nbsp; That is, which of the two should effect the outcome?&lt;/p&gt;</description></item><item><title>Re: BUG: Order of opperations in Action parameter validation seems wrong.</title><link>http://forums.asp.net/thread/2239012.aspx</link><pubDate>Tue, 18 Mar 2008 04:43:14 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2239012</guid><dc:creator>tgmdbm</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2239012.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=2239012</wfw:commentRss><description>&lt;p&gt;PS. Not a bug.&amp;nbsp;&lt;/p&gt;</description></item><item><title>Re: BUG: Order of opperations in Action parameter validation seems wrong.</title><link>http://forums.asp.net/thread/2239009.aspx</link><pubDate>Tue, 18 Mar 2008 04:42:36 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2239009</guid><dc:creator>tgmdbm</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2239009.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=2239009</wfw:commentRss><description>&lt;p&gt;&lt;b&gt;+1&lt;/b&gt; Great Idea,&lt;/p&gt;&lt;p&gt;All they&amp;#39;d have to do is move some code around inside Controller.InvokeActionMethod(IMethodInfo, RouteValueDicitionary) and put the Parameter Values inside the FilterExecutingContext for us to fudge with.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;You&amp;#39;re right about what happens.&lt;/p&gt;&lt;p&gt;If the method has an argument that isn&amp;#39;t in the RouteData, or the QueryString, or the Form, it&amp;#39;s deemed missing. If it does exist but you can&amp;#39;t convert it to the corrent Type then it&amp;#39;s deemed missing.&lt;/p&gt;&lt;p&gt;THEN it invokes the ActionFilters and THEN invokes the controller action.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description></item><item><title>BUG: Order of opperations in Action parameter validation seems wrong.</title><link>http://forums.asp.net/thread/2238847.aspx</link><pubDate>Tue, 18 Mar 2008 02:48:25 GMT</pubDate><guid isPermaLink="false">4c671506-2930-414c-a40b-8bf57ded5924:2238847</guid><dc:creator>nberardi</dc:creator><slash:comments>0</slash:comments><comments>http://forums.asp.net/thread/2238847.aspx</comments><wfw:commentRss>http://forums.asp.net/commentrss.aspx?SectionID=1146&amp;PostID=2238847</wfw:commentRss><description>&lt;p&gt;So today I ran into a something that seems like a bug to me. So here is the order of operations, first how they happened.&amp;nbsp; &lt;/p&gt;&lt;p&gt;Action:&lt;/p&gt;&lt;pre class="coloredcode"&gt;[CaptchaValidation]
&lt;span class="kwd"&gt;public void&lt;/span&gt; Login(&lt;span class="kwd"&gt;string&lt;/span&gt; userName, &lt;span class="kwd"&gt;string&lt;/span&gt; password, &lt;span class="kwd"&gt;bool&lt;/span&gt; captchaValid)&lt;/pre&gt;The source to CaptchaValidationAttribute is at &lt;a href="http://code.google.com/p/coderjournal/source/browse/trunk/ManagedFusion.Web.Captcha/ManagedFusion.Web.Captcha/CaptchaValidationAttribute.cs"&gt;http://code.google.com/p/coderjournal/source/browse/trunk/ManagedFusion.Web.Captcha/ManagedFusion.Web.Captcha/CaptchaValidationAttribute.cs&lt;/a&gt;&lt;p&gt;The parameter captchaValid is set by the attribute in OnActionExecuting.&amp;nbsp; It is not derived from the URL.&amp;nbsp; It is added directly in to the RouteData.&lt;/p&gt;&lt;p&gt;However the Action refuses to execute stating that captchaValid needs to be nullable since there is no default for it set in the RouteData, at least not yet.&amp;nbsp; So an exception is thrown before OnActionExecuting is executed.&amp;nbsp; This forces me to change the parameter to bool? captchaValid, which is really not what I want.&lt;/p&gt;&lt;p&gt;This is what I imagine the current process is&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Check parameters for defaults and throw error when not valid&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Run OnActionExecuting&lt;/li&gt;&lt;li&gt;Pass parameters in to Action&amp;nbsp;&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;I think that the process should be the following to give me a chance to set defaults in the OnActionExecuting.&lt;/p&gt;&lt;ol&gt;&lt;li&gt;Run OnActionExecuting&lt;/li&gt;&lt;li&gt;Check parameters for defaults and throw error when not valid&lt;/li&gt;&lt;li&gt;Pass parameters in to Action&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;I would be interested to get this in the hands of the MVC team.&lt;/p&gt;&lt;p&gt;Thanks,&lt;/p&gt;&lt;p&gt;Nick&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item></channel></rss>