Posts

Captcha - Preventing Pressing Back To Retry Captcha

Found that in some cases if a user presses back, then our captcha solution would redisplay the image.  This would potentially allow a user to retry the same captcha over again which for security reasons would be bad. Placing these in the Load section of the page seems to have removed that issue.:         Response.AppendHeader("Cache-Control", "no-cache, no-store, must-revalidate") 'HTTP 1.1.         Response.AppendHeader("Pragma", "no-cache") 'HTTP 1.0.         Response.AppendHeader("Expires", "0") 'Proxies. http://stackoverflow.com/questions/49547/how-to-control-web-page-caching-across-all-browsers/2068407#2068407

Back Problems - The Importance of Exercise and Good Posture

It may be time to talk to a physical trainer or your doctor if you experience any back pain.  Turns out one day I woke up with horrible back pain.  Now after many months am I finally feeling "not in horrible pain constantly".  So if you are like me where your job and your hobby are dealing with computers, maybe you should consider asking some professionals for advice.  Hah...

XML to String with UTF-8 encoding

Was having some issues trying to post with some xml data in utf-8 format, since it kept coming out in utf-16 even though I would set the contenttype and other settingsand somehow ignoring them.  I found an article that gave me a solution where they create a class that overrides the encoding of the string writer to utf-8 and that worked. ......  Dim sb = New StringBuilder()             Using writer As StringWriter = New StringWriterUtf8(sb)                 xmlDoc.Save(writer)             End Using             Return sb.ToString() ....... then in a class    Public Class StringWriterUtf8         Inherits StringWriter         Public Sub New(sb As StringBuilder)             MyBase.New(sb)         End Sub         Public Overrides ReadOnly Property Encoding() As Encoding             Get                 Return Encoding.UTF8             End Get         End Property     End Class ....... http://rlacovara.blogspot.com/2011/02/how-to-create-xml-in-c-with-utf-8.html

Telerik RadGrid - Group Continued Message in Group Header When Paging Off

So using the Telerik RadGrid is pretty great, but it does seem to have its share of issues.  Not finding any serious issues though it is quite flexible. The odd message "GROUP CONTINUED FROM THE PREVIOUS PAGE. SHOWING 1 OF 2 ITEMS.)" would show up in one of my group headers even when paging was off with  AllowPaging="false"  in the top RadGrid section and in the MasterTableView.  Placing the GroupContinuedFormatString="" worked fine like below. <GroupingSettings GroupContinuedFormatString=""  CollapseAllTooltip="Collapse all groups"></GroupingSettings> This will not work, at least it does not in mine, it actually crashes the page.  <GroupingSettings  IgnorePagingForGroupAggregates="true" ></GroupingSettings> ------- Update Seems like this may not be enough to get rid of the problems.  Some other messages are creeping in there.

Telerik - Custom Group Footers In RadGrid

As anyone that has dealt with this knows Telerik only supports a single Group or Header Template.  So what happens when you want to change them?  You really only have two options from what I have seen.  The first option is to have something in the data that is brought back that you can use in the designer code in the form of a conditional.  Too bad I do not see a way to check the data based on level like some sort of ParentID like some people have done.  If the ParentID is null  It would look something like below where you check it in the designer: < asp : Label runat = "server" ID = "Label2" Text = '<%# "Number of items in group: "+ (((GridGroupHeaderItem)Container).AggregatesValues["AvailableUnits"]) %>' Visible = '<%# ((((GridGroupHeaderItem)Container).AggregatesValues["AvailableUnits"]) != null)%>' > Or you can use the code behind to really get at the groupIDs like this per

CSS Transitions - Only Complete Half of the Cycle

Starting to learn CSS Transitions and I have to say they are great!  When learning one thing that I encountered was that the transition would not smoothly rewind after completing half the cycle.  So for instance, smoothly changing the color to another, but when I remove the mouse from the element it reverts back without any transition.   As I am sure most of you have guessed, I was not placing the transition elements in the correct spot.  I was placing them in the hover event, while they need to be in the default state.  Looks like translations need to put in the CSS event.   Also, using -Prefix-Free makes all this stuff easier too, where you do not need to add the prefixes for each browser. Ref: https://www.sitepoint.com/community/t/webkit-transition-working-in-only-one-direction/7223/3 https://leaverou.github.io/prefixfree/

Asp.Net - Restricting File Upload Size Client Side

So the problem I encountered was that the site would throw an ugly "maxAllowedContentLength exceeded" error when a user would try to upload a file beyond a certain size.  One of the difficulties with this is that the error is thrown before it even gets to an event, so you cannot try to handle it there. One solution that worked locally for me was to modify the web.config in two places, I will link that page below.  Too bad for me that solution did not work on the server for some unknown reason.  I had also tried handling it in the global.asax, but DNN, our CMS, is somehow preventing that from working.  I will link that too below.  So then I turned to a client side way of restricting it.    The way the client side restriction works is that it uses a newer functionality of html5 that allows most browsers to get the file size.   Older browsers will not work with this, but at this point I am fed up with this and DNN. Also if they disable Javascript they can upload files larger, b