Code Monkey home page Code Monkey logo

Comments (8)

madskristensen avatar madskristensen commented on August 20, 2024

This looks like a datetime issue. Miniblog should check to see if the LastModified date of a blog post is newer than DateTime.UtcNow. If so, it should fall back to DateTime.UtcNow. I'll take a look

from miniblog.

madskristensen avatar madskristensen commented on August 20, 2024

Please try with the latest source code. I just committed a fix. Since I can't repro it locally, could you please verify that the fix worked?

from miniblog.

cdhunt avatar cdhunt commented on August 20, 2024

Same error. What version of Windows and .Net are you testing on?

On Mon, Apr 21, 2014 at 6:35 PM, Mads Kristensen
[email protected]:

Please try with the latest source code. I just committed a fix. Since I
can't repro it locally, could you please verify that the fix worked?


Reply to this email directly or view it on GitHubhttps://github.com//issues/74#issuecomment-40984965
.

from miniblog.

madskristensen avatar madskristensen commented on August 20, 2024

I'm on 4.5. The error is a datetime issue. It appears that it tries to set the last modified header to be in the future and that's what causes the exception. Are you hosting on Azure? If so, can you attach the remote debugger from Visual Studio 2013 in the Server Explorer. Then set a breakpoint and see what the values are compared to DateTime.UtcNow?

from miniblog.

cdhunt avatar cdhunt commented on August 20, 2024

I'm not using Azure, just IIS. The value of lastModified appears to be DateTime.UtcNow. Here is the stacktrace from Visual Studio. However, the exception actually occures in Index.cshtml at line 59. I moved lastModified = DateTime.UtcNow < lastModified ? DateTime.UtcNow : lastModified; to just before and it doesn't help.

capture

System.ArgumentOutOfRangeException was unhandled by user code
  HResult=-2146233086
  Message=Specified argument was out of the range of valid values.
Parameter name: utcDate
  Source=System.Web
  ParamName=utcDate
  StackTrace:
       at System.Web.HttpCachePolicy.UtcSetLastModified(DateTime utcDate)
       at System.Web.HttpCachePolicy.SetLastModified(DateTime date)
       at Blog.SetConditionalGetHeaders(DateTime lastModified, HttpContextBase context)
       at ASP._Page_Index_cshtml.Execute() in c:\inetpub\wwwroot\MiniBlog\Index.cshtml:line 59
       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
       at System.Web.WebPages.WebPage.ExecutePageHierarchy()
       at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
       at System.Web.WebPages.WebPageHttpHandler.ProcessRequestInternal(HttpContextBase httpContext)
  InnerException: 

from miniblog.

madskristensen avatar madskristensen commented on August 20, 2024

What timezone is your Windows machine running IIS using?

from miniblog.

cdhunt avatar cdhunt commented on August 20, 2024

I'm still getting my head around this, but I think I found a fix. Changed line 59 on Index.cshtml to Blog.SetConditionalGetHeaders(lastModified.ToLocalTime(), Context); based on information from http://www.hanselman.com/blog/BackToBasicsDaylightSavingsTimeBugsStrikeAgainWithSetLastModified.aspx that should be completely unrelated.

I was able to create a new post and the timestamp on the page is correct.

capture

from miniblog.

madskristensen avatar madskristensen commented on August 20, 2024

Great. Send a PR :)

from miniblog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.