Exception: File does not exist
Exception: File does not exist
Exception: File does not exist
Exception: File does not exist
Exception: File does not exist
Exception: File does not exist Exception: File does not exist Exception: File does not exist Exception: File does not exist Exception: File does not exist Exception: File does not exist Exception: File does not exist Exception: File does not exist
Exception: File does not exist Exception: File does not exist
Exception: File does not exist
Go Back  Xtreme Visual Basic Talk > > > Exception: File does not exist


Reply
 
Thread Tools Display Modes
  #1  
Old 05-28-2013, 10:05 AM
an_ezfriend an_ezfriend is offline
Newcomer
 
Join Date: Mar 2004
Posts: 11
Default Exception: File does not exist


I have a default.aspx page in my subfolder (Document) which uses the Main.Master template on the root folder. The Main.Master template reference a logo in the IMAGES folder. Each time I navigate to the subfolder (or any subfolders), I always get the exception below which the default.aspx in the subfolder is trying to find images/logo.png.

File does not exist. http://localhost:2079/Document/images/logo.png

I appreciate your inputs.

Main.Master (root)
<a href="default.aspx" runat="server"><img id="x_company_logo" src="images/logo.png" runat="server" border="0"/>

Root struction
Main.Master
images/logo.png
Document/default.aspx
--------------------------------------------------------------------------
Exception TYpe
HttpException

Message
File does not exist.

Stack Trace
at System.Web.StaticFileHandler.GetFileInfo(String virtualPathWithPathInfo, String physicalPath, HttpResponse response)
at System.Web.StaticFileHandler.ProcessRequestInternal(HttpContext context, String overrideVirtualPath)
at System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApp lication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Reply With Quote
  #2  
Old 05-28-2013, 01:15 PM
PlausiblyDamp's Avatar
PlausiblyDampException: File does not exist PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

The problem is that the src attribute is being resolved relative to the page, not relative to the master page.

You could try modifying the <img> tag so it looks like
Code:
<img src="<%=Request.ApplicationPath%>/Images/logo.png" />
This should then always resolve to an absolute path based on the application root folder.
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #3  
Old 05-28-2013, 02:59 PM
an_ezfriend an_ezfriend is offline
Newcomer
 
Join Date: Mar 2004
Posts: 11
Default

I tried that, but the Main.Master template just render it as is. Through further search on the net, I came across this page http://www.codeproject.com/Articles/...sp-net-beginne, but I still no able to resolved the exception.

The logo display fine, just that I keep getting the exception because when the page load, it tries to reference document/images/logo.png rather than ../images/logo.png or ~/images/logo.png

For now -- since I know that the logo will always going to be at a location, I just hard code the full path to the website.

Very frustrated for simple thing.
Reply With Quote
  #4  
Old 05-28-2013, 03:54 PM
PlausiblyDamp's Avatar
PlausiblyDampException: File does not exist PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

Quote:
Originally Posted by an_ezfriend View Post
I tried that, but the Main.Master template just render it as is.
Is the string being rendered as a literal into the html or if you look at the source is it rendering an <img> tag?

Could you post the line from the master and also the resulting html? The code I posted should correctly render the root of the application as part of the src="" attribute on the element.

Are you also getting an exception thrown from the code behind? If so what code is throwing the exception?
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #5  
Old 06-03-2013, 08:02 AM
an_ezfriend an_ezfriend is offline
Newcomer
 
Join Date: Mar 2004
Posts: 11
Default

Sorry for the late response and thank you for your help. The code above is a straight copy from the page source. I also post the exception error on the original post, but here it is again.

--------------------------------------------------------------------------
Exception TYpe
HttpException

Message
File does not exist.

Stack Trace
at System.Web.StaticFileHandler.GetFileInfo(String virtualPathWithPathInfo, String physicalPath, HttpResponse response)
at System.Web.StaticFileHandler.ProcessRequestInternal(HttpContext context, String overrideVirtualPath)
at System.Web.DefaultHttpHandler.BeginProcessRequest(HttpContext context, AsyncCallback callback, Object state)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApp lication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Reply With Quote
  #6  
Old 06-03-2013, 08:36 AM
PlausiblyDamp's Avatar
PlausiblyDampException: File does not exist PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

That isn't giving any more information about where the error is occurring though, if you run your application under a debugger is it throwing an exception anywhere or entering into break mode?

Is there anywhere in your code you are referring to this image path?
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
  #7  
Old 06-04-2013, 05:27 PM
an_ezfriend an_ezfriend is offline
Newcomer
 
Join Date: Mar 2004
Posts: 11
Thumbs down

My logo reference on the markup of my master page as follow:
Code:
<asp:Image ID="Image1" runat="server" ImageUrl="~/images/logow.png" height="60px" Width="171px"/>
I walk through the code, the default.aspx in the subfolder loaded fine, then it went through the Page_Load event in the master page fine. Right after it exit the master page Page_Load event, it goes into the Application_Error in my global.asax. That's where I capture the error. The error exception above was capture using Server.GetLastError.

Thanks.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Exception: File does not exist
Exception: File does not exist
Exception: File does not exist Exception: File does not exist
Exception: File does not exist
Exception: File does not exist
Exception: File does not exist Exception: File does not exist Exception: File does not exist Exception: File does not exist Exception: File does not exist Exception: File does not exist Exception: File does not exist
Exception: File does not exist
Exception: File does not exist
 
Exception: File does not exist
Exception: File does not exist
 
-->