Life, Surf, Code and everything in between
White Papers
|
Free Tools
|
Products
|
Message Board
|
News
|
Web Log Home
Site Home
Subscribe to Feed
Contact
Search
Posts - 1217
Comments - 16108
Rick's Sites
Rick's FoxPro Web Log
CodePaste.net
Rick's Photos
Rick's Music
Find this content useful? Consider making a small donation to show your support.
Now Reading
Applying Domain-Driven Design and Patterns Publisher: Addison-Wesley Professional
by Jimmy Nilsson
Shantaram: A Novel
by Gregory David Roberts
2030: The Real Story of What Happens to America
by Albert Brooks
Twitter Status
Last 24 Comments
re: Integrating OpenID in an ASP.NET MVC Application using DotNetOpenAuth
Today @ 8:50 am | by
Shyju
Is there any workaround if the server time is behind UTC time, My code is returning an error saying the the "The message expirefd at XXXX time and the server time is XXXXX. Obviously because the Server time is behind the UTC time. My hosting (shared) is not ready to change their server time.
re: Error on 64 Bit Install of IIS – LoadLibraryEx failed on aspnet_filter.dll
Yesterday @ 2:52 pm | by leo_21
I was loosing hope and thinking I'd had to reinstall IIS but thanks to you I've got it fixed so many thanks. In adition to your port the modiffication can be done not only over the website but over the whole server just choosing the server and then the Configuration Editor so if one adds new pages then, they won't get misconfigured cause the global config should be fine, many thanks for this post, as some said this post should be the first result google must show.
re: DropDownList and SelectListItem Array Item Updates in MVC
Thursday @ 8:40 am | by
Javier Callico
I had a similar issue myself also caused by an static list of items been used across different requests (threads). Thanks for sharing your solution.
re: DropDownList and SelectListItem Array Item Updates in MVC
Wednesday @ 12:30 pm | by
Rick Strahl
@Larry - that might work, but the list is used in number of places so it becomes tedious and unobvious that this is required - I think it's better to fix this at the source rather than special casing in the actual controller methods which is easy to forget.
FWIW, I didn't know that you can actually do that or what the syntax for this looks like - good to know. This might actually make a lot of sense for other scenarios.
re: DropDownList and SelectListItem Array Item Updates in MVC
Wednesday @ 12:23 pm | by Larry
could you not use the POST Action Method's Bind attribute to exclude the model.CategoryList property from the model binder, since you're refetching it from cache anyway?
would that prevent it from updating the CategoryList while still allowing it to set model.QueryParameters.Category?
re: DropDownList and SelectListItem Array Item Updates in MVC
Wednesday @ 11:40 am | by
Rick Strahl
@Vova - No it's an issue in all versions of MVC - just so happens this is the first time I've stumbled into this. The reason the ModelBinder 'knows about' the cached list is because a reference to it is on the model that I'm binding to - I'm passing it out of the GetCachedCategories() function which originally simply returned the static list. My assumption was that the SelectList[] was read only - but the ModelBinder actually updates the list if it's bound. Actually I'm not sure whether this is the binder's doing or the Html.DropDownlist() helper which assigns the value once it knows what the selected value/values from the model/Postback are. Something sets the Selected value of the item selected between the two. It'd be interesting to look into the code for ListBox/DropDownlist helpers.
@Amit - yes I was thinking about caching the domain object originally, but since I only needed a couple of values rather than a full entity and 100% of the use cases involve a drop down list I decided to return the SelectList[] instead.
re: Web Browser Control – Specifying the IE Version
Wednesday @ 11:33 am | by
Rick Strahl
@kobik - I haven't figured out a way to do this at runtime. I suppose it is possible since the IE Tools let you switch the engine on the fly but I have no idea how that can be done. As far as I can tell the values are read only when the engine is created in an app for the first time.
re: Web Browser Control – Specifying the IE Version
Wednesday @ 10:57 am | by kobik
@Rick, very good post! Thanks.
The main problem I'm trying to solve, is how to SWITCH modes at run-time (like IE developer tools does).
My application itself (not the installer) updates the registry as done by @Asdf (since I write to HKCU there is no UAC issue). I'm also using Delphi btw.
But the problem is how to refresh/reload the WB control and tell it that the registry setting were changed... It seems that the key value is read by the FIRST instance of the WB control that was created by the application. so even, If you destroy the control, change reg value , and create a new instance, the old value is preserved until you restart your application.
Maybe there is an Exec command for this, or a special message?
Any ideas?
re: DropDownList and SelectListItem Array Item Updates in MVC
Wednesday @ 9:54 am | by Amit
This is a typical problem even if using Cache. If the object from cache is returned as is (without cloning) and for some reason the returned object is modified (in this case by ModelBinder), the original object in the Cache is modified. I have also run into this.
On the side note, I prefer to cache the domain entity (in this case categories) instead of the select list, as then it can be used in other places as well.
re: DropDownList and SelectListItem Array Item Updates in MVC
Wednesday @ 7:55 am | by Vova
Interesting. So, is it MVC4 specific issue? And how ModelBinder would know about the cached list? Form what I can see, when it binds received (form) data to view model there are no items in SelectList, so it can set only SelectedValue property. How it managed to track depndencies between your static (cached) variable and SelectList in view model?
re: DropDownList and SelectListItem Array Item Updates in MVC
Wednesday @ 3:42 am | by
Rick Strahl
@TheSaintr - yes Cache would work, but as I mentioned that list so rarely changes that it really doesn't matter. It wouldn't really change the logistics and I prefer not tying things to the HttpContext pipeline if I can avoid it :-)
re: DropDownList and SelectListItem Array Item Updates in MVC
Wednesday @ 3:38 am | by TheSaintr
Why don't you use Cache instead of static object..
Doing so you can "clear" that cache item to refresh... with static you have to restart/recycle your site
re: Passing multiple POST parameters to Web API Controller Methods
Tuesday @ 2:02 pm | by
Rick Strahl
@Jonathan - sure. You need to be able to JSON encode - meaning you need Json.net or System.Json to provide the parsing. The new System.Net.Http library also includes a host of methods that make it easy to call JSON and XML endpoints and provide the type marshalling required to use the data sent and returned more easily.
re: Passing multiple POST parameters to Web API Controller Methods
Tuesday @ 1:24 pm | by Jonathan
How would you make a call to this type of Web API from a WinForms app? Is that even possible. Thanks.
Jonathan
re: Problems with opening CHM Help files from Network or Internet
Tuesday @ 5:54 am | by Tony
For those who can't access the 'Unblock" option,
Make sure the file name does not contain the '#' sign or even the folder name of the folder it's contained in.
Have a look at the post I've linked below.
http://saifulmuhajir.me/2011/01/23/solve-i-cant-open-chm-files-in-windows-7/
:)
re: ActiveX component can't create Object Error? Check 64 bit Status
Tuesday @ 5:21 am | by Aniruddha
Hi,
i tried your solution, now i m able to create object for active X component, but
i m not able to debug the same in VS2010.
i m using classic asp pages and VB6 dll.
please give me a solution to this.
re: Error on 64 Bit Install of IIS – LoadLibraryEx failed on aspnet_filter.dll
Monday @ 6:55 am | by Sudarsan
It is a great article. Thank you very much for posting. It worked like a charm and saved my life..
re: Built-in GZip/Deflate Compression on IIS 7.x
Monday @ 3:46 am | by Cesar
@Cory - I know it's old, but this can help you:
http://stackoverflow.com/questions/4584956/compressing-a-web-service-response-for-jquery
re: Passing multiple POST parameters to Web API Controller Methods
May 09, 2012 @ 11:37 pm | by
Rick Strahl
@BackToTheFuture - what browser are you using? If you're running older browsers you'll have to add json2.js to your script includes. Newer browsers (IE9, FF, Chrome, Opera) all support native JSON conversion. Note it's also case sensitive so the method JSON.stringify().
re: Passing multiple POST parameters to Web API Controller Methods
May 09, 2012 @ 8:54 pm | by BackToFuture
For me the JSON.Stringify does not work it returns null movie and 01/01/0001 as date
re: Passing multiple POST parameters to Web API Controller Methods
May 09, 2012 @ 10:34 am | by magellings
JObject in particular looks very handy. I love how the client/server interaction is so simple with this new Web API. It doesn't get much easier than passing a JSON string and then parsing it out. It also really promotes cross-platform/language interoperability (as HTTP REST naturally does).
re: Passing multiple POST parameters to Web API Controller Methods
May 09, 2012 @ 5:45 am | by
Paul Speranza
Thanks Rick. I haven't worked with Web API yet but I'll bet you just saved me a lot of hair pulling.
re: Custom ASP.NET Routing to an HttpHandler
May 08, 2012 @ 3:22 pm | by
Vitaly Tomilov
A different look on URL Routing for HttpHandler, when performance matters:
http://www.codeproject.com/Articles/380098/Basic-Routing-for-HttpHandler
re: ASP.NET MVC Postbacks and HtmlHelper Controls ignoring Model Changes
May 08, 2012 @ 7:26 am | by magellings
Yeah I ran into the same problem....took a while to figure out.
© Rick Strahl, West Wind Technologies, 2005 - 2012