URL encoded colon resolves in 400 Bad Request

It seems that ASP.net does not allow colons before the ‘?’ in an URL, even if it is encoded as %3A. For example, these won’t work http://foo.org/api/persons/foo:bar http://foo.org/api/persons/foo%3abar But this works: http://foo.org/api/persons?id=foo%3abar In all examples, we would expect ASP.NET MVC to pass “foo:bar” as an id argument, properly decoded. I just tested this with MVC4 … Read more

How is HttpOnly get set for ASP.NET_SessionId cookie?

ASP.NET session cookies are HTTP only, regardless of the httpOnlyCookies setting linked to in your question, because this is burned into ASP.NET. You can’t override this. If you dig into the System.Web.SessionState.SessionIDManager class in the System.Web assembly the code for creating the ASP.NET session cookie looks like: private static HttpCookie CreateSessionCookie(string id) { HttpCookie cookie … Read more

From where CultureInfo.CurrentCulture reads culture

the MSDN says The culture is a property of the executing thread. This read-only property is equivalent to retrieving the CultureInfo object returned by the Thread.CurrentCulture property. When a thread is started, its culture is initially determined by calling the Windows GetUserDefaultLocaleName function. In other words, it’s based on the Thread, witch has a context… … Read more

ASP.NET MVC alongside Web Forms in the same web app?

Mvc is build on top of asp.net as is webforms, so yes it’s easy. Done it couple of times for conversion purposes Maybe this url’s could help you: http://www.hanselman.com/blog/IntegratingASPNETMVC3IntoExistingUpgradedASPNET4WebFormsApplications.aspx and http://www.hanselman.com/blog/PlugInHybridsASPNETWebFormsAndASPMVCAndASPNETDynamicDataSideBySide.aspx

A potentially dangerous Request.Form value was detected from the client (textboxError=”

Your problem is that the value of one of your fields (textboxError) includes XML- or HTML-style tags, which by default are disallowed to avoid developers introducing potential security issues within their applications. The solution is given in the error message; you need to add validateRequest=”false” in either the @Page directive at the top (omitted in … Read more

IValidatableObject Validate method firing when DataAnnotations fails

Considerations after comments’ exchange: The consensual and expected behavior among developers is that IValidatableObject‘s method Validate() is only called if no validation attributes are triggered. In short, the expected algorithm is this (taken from the previous link): Validate property-level attributes If any validators are invalid, abort validation returning the failure(s) Validate the object-level attributes If … Read more

Classic ASP Outbound TLS 1.2

I found a solution with a simple registry fix. 1) Register TLS 1.2 Protocol: Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2] [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client] “Enabled”=dword:ffffffff “DisabledByDefault”=dword:00000000 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server] “Enabled”=dword:ffffffff “DisabledByDefault”=dword:00000000 2) Configure TLS 1.2 to be default in 32 bit applications: Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings\WinHttp] “DefaultSecureProtocols”=dword:00000800 3) Configure TLS 1.2 to be default … Read more

Button click not working inside update panel

Try this set ChildrenAsTriggers to true and add EventName=”Click” in asp:AsyncPostBackTrigger <asp:UpdatePanel ID=”updatePanel2″ runat=”server” UpdateMode=”Conditional” ChildrenAsTriggers=”true”> <ContentTemplate> <asp:Button ID=”btnBlock” class=”Button” Text=”BlockCalls” runat=”server” onclick=”btnBlock_Click” Enabled=”True” Width=”100px” /> </ContentTemplate> <Triggers> <asp:AsyncPostBackTrigger ControlID=”btnBlock” EventName=”Click”/> </Triggers> </asp:UpdatePanel>