This is a migrated thread and some comments may be shown as answers.

getting wrong path for texture file - 500 error

2 Answers 230 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Entilzha
Top achievements
Rank 2
Entilzha asked on 01 Oct 2013, 12:39 AM
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 Answers, 1 is accepted

Sort by
1
Accepted
Entilzha
Top achievements
Rank 2
answered on 01 Oct 2013, 01:05 AM
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;
1
Entilzha
Top achievements
Rank 2
answered on 01 Oct 2013, 01:06 AM
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.
Tags
General Discussions
Asked by
Entilzha
Top achievements
Rank 2
Answers by
Entilzha
Top achievements
Rank 2
Share this question
or