getting wrong path for texture file - 500 error

3 posts, 1 answers
  1. Entilzha
    Entilzha avatar
    36 posts
    Member since:
    Feb 2012

    Posted 30 Sep 2013 Link to this post

    This is a weird problem.  The issue occurs only occasionally.  There is an image file in the "~/Content/textures/" directory called "highlight.png" (a Kendo UI file).  Occasionally when I try to create a new "Event" in the Scheduler I will get a 500 error.  Here is the message:

    "NetworkError: 500 Internal Server Error - http://mywebsite.azurewebsites.net/error/Error?aspxerrorpath=/Sessions/textures/highlight.png"

    You can see it is looking for the file in "~/Sessions/textures/".  This is wrong!  The "Sessions" component is the controller where this is being execute but the file is actually in "~/Content/textures/".  Yes, I have the folder and file included in the VS 2012 project.  Another time I got a "404 Not Found" for the same file with the bad path when I looked inside the NET tab of Firebug in the "GET highlight.png" trace.  This also succeeds with the right path sometimes.

    Does this make any sense to anyone?  How could this get the wrong path half the time?
  2. Answer
    Entilzha
    Entilzha avatar
    36 posts
    Member since:
    Feb 2012

    Posted 30 Sep 2013 Link to this post

    Found my own answer!  I spent a couple of hours looking into this problem before posting so don't laugh that I found the answer within 15 minutes of posting this question. Okay, maybe laugh a little. ;o)

    What I had done was customized the ".k-event" style locally within the .cshtml file.  So of course it was going to get confused.

    background: url("textures/highlight.png") repeat-x scroll 0 -257px #38B9FF;
    so I added some relative path corrections and it started working.  Btw, I tried using tilde in an absolute path but apparently that is not a good thing to do in a style.
    background: url("../../Content/textures/highlight.png") repeat-x scroll 0 -257px #38B9FF;
  3. UI for ASP.NET MVC is VS 2017 Ready
  4. Entilzha
    Entilzha avatar
    36 posts
    Member since:
    Feb 2012

    Posted 30 Sep 2013 Link to this post

    Oh, and I do not know why sometimes it worked and sometimes it didn't.  I just executed this code a dozen times and the problem has not re-occurred.
Back to Top