C# - Controller Path Not Found For Static Images?

Mar 25, 2010

I have an image folder stored at ~/Content/Images/

I am loading these images via

<img src="/Content/Images/Image.png" />

Recently, the images aren't loading and I am getting the following errors in my error log. What's weird is that some images load fine, while others do not load.

what is wrong with my routes? Am I missing an ignore route for the /Content/ folder?

I am also getting the same error for favicon.ico and a bunch of other image files...

<Fatal> -- 3/25/2010 2:32:38 AM -- System.Web.HttpException: The controller for path '/Content/Images/box_bottom.png' could not be found or it does not implement IController.
at System.Web.Mvc.DefaultControllerFactory.GetControllerInstance(Type controllerType)
at System.Web.Mvc.DefaultControllerFactory.CreateController(RequestContext requestContext, String controllerName)
at System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext)
at System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext)
at System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

My current routes look like this:

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = "" } // Parameter defaults
);
routes.MapRoute(
"ControllerDefault", // Route name
"{controller}/project/{projectid}/{action}/{searchid}", // URL with parameters
new { controller = "Listen", action = "Index", searchid = "" } // Parameter defaults
);

View 5 Replies


Similar Messages:

Accessing Static MVC Controller Method From View

Mar 16, 2011

I've got an .aspx page with this in it:

<%@ Import Namespace="System.Web.Mvc" %>
<%= AssetController.ScriptTag("/js/Community/CommunityWizard.js")%>

And I have an AssetController class:

Imports System.Web.Mvc
Public Class AssetController
Inherits Controller
Public Shared Function ScriptTag(ByVal src As String) As String
Return String.Format(
"<script type='text/javascript' src='/js.mvc?src={0}&{1}'></script>",
System.Web.HttpContext.Current.Server.UrlEncode(src),
New BuildVersion().ToString()
)
End Function
End Class

The project has a reference added to the 3.0.0.0 version of System.Web.Mvc assembly. When I try to view the page in a browser, I get a HTTP 500 with this message:

BC30007: Reference required to
assembly 'System.Web.Mvc,
Version=3.0.0.0,
Culture=neutral, PublicKeyToken=31bf3856ad364e35'
containing the base class
'System.Web.Mvc.Controller'. Add one to your project.

What gives? I don't understand why I can use this controller everywhere in our ASP.NET Forms/MVC hybrid application, but not in a view. EDIT: In fact, when I type <% System.Web. into the .aspx view, Mvc doesn't even appear in Intellisense!

View 2 Replies

C# - Getting Project Root Path In Controller .NET MVC?

Mar 5, 2011

I am using dotlesscss for my css and I remember how to use that but what I am forgetting is how to get the root project path so that I can generate the full file path to my .less file to get for the less engine to parse. How do I get the project root path so that I can generate the path for my less files?

View 1 Replies

Can Browse Images And Static Html Pages

Oct 14, 2010

I had an ASP.NET 1.1 application that I converted to 2.0. I deployed the application under IIS 7 on Windows 2008 Server. I can browse images and static html pages but I can't browse .aspx pages. When I try to run any .aspx page, my browser says "Internet Explorer cannot display the webpage". My application pool is set to .NET framework 2.0 with Integraded in Managed Pipeline mode.

View 1 Replies

Web Forms :: Add Static And Hover Images To Menu Control?

Feb 5, 2010

i have a menu control which i get text from a sitemap.

But i want to use hover images and static images? can this be achieved?

View 2 Replies

Why Images Are Not Found After Response.Redirect

Oct 1, 2010

I have a parts.aspx page that displays correctly when user navigates to it from the menu. I also have code behind another page that redirects to to parts.aspx and when that happens everything works except the images on parts.aspx do not display, just the alternate text. The images are in an Images subfolder of the folder containing parts.aspx. So why are the images files not located? using asp 2.0, VS 2005.

View 1 Replies

Images Via IIS Or Controller ActionResults?

Nov 5, 2010

I have an ASP.NET MVC2 application that is maintaining a library of about 10GB of images. Many of these are customized by the application. We had been storing these in SQL but for a number of reasons, we are moving our images to the file system.

The file system vs SQL issue aside, should I be serving up my images through ActionResults on Controllers or directly serving them up via IIS and a separate web site? The former offers a number of advantages such as control over caching and some dynamic redirection but I would assume directly accessing files via IIS will be more efficient. How big an efficiency hit will I take serving up the images myself?

View 3 Replies

Get The Physical Controller Class File Path Of The Executing Action Method?

Dec 21, 2010

Assume the current executing action method is Index() in Home controller. From within Index(), how to obtain the physical file path of the Home controller? Assume we don't know the file structure until runtime.

View 2 Replies

Finding Path To Css And Images?

Mar 1, 2010

For example I have site http://localhost/site In IIS I set that 404 error causes redirection to default.aspx
If I type something like http://localhost/site/nodirectory , (there are no such folder) all works perfectly.

But if I only add slah at end http://localhost/site/nodirectory/, page can't display css and images.

Images and css are located in their own folder. I tried different paths: "gfx/logo.gif", "/gfx/logo.gif"

View 2 Replies

Access Images Outside The Web Path?

Mar 29, 2011

How can i display images that are saved outside the the WebSite folder.

View 2 Replies

Upload Images To Website - Store Path On DB And Show Them?

Jan 27, 2010

I'm using ASP.NET with C# and MySql. I'm trying to upload images to my website, to a folder called images, and to store the path on my MySql Database. And i want to show the images by using the path stored on the bank. Above is my code to insert images to the website.

[Code]....

View 1 Replies

Web Forms :: Code Is Upload Images Which Are On The Desktop Not From Another Path?

Nov 26, 2010

string fileName = FileUpload1.FileName; if (FileUpload1.HasFile && FileUpload1.FileBytes.Length < 2048) { fileName = new Random().Next() + "-" + FileUpload1.FileName; // My upload folder path is C:ConvocationWEbsite1Upload FileUpload1.SaveAs(Server.MapPath("~/Upload/")
+ fileName); } else { lblerr.Text = " File size should be less than 2 MB."; }

Reply me as soon as possible.

View 3 Replies

Data Controls :: Absolute Path For Images In Datalist

Sep 27, 2012

I have a Datalist where I want to retrive Images from a folder and I have done URL rewritting so Images is not displaying when I write something like this:

<asp:HyperLink ID="HyperLink1" ImageUrl='<%# Bind("Product_Image", "~/ProductImages/{0}") %>'
NavigateUrl='<%#"http://localhost:49524Mysite/Product/" + stringToBase64String(Eval("ProductID").ToString())%>' CommandName="IMG" CommandArgument='<%# Eval("ProductID")%>' runat="server"></asp:HyperLink>
 
[CODE]..

I don't want to write whole URL.

View 1 Replies

Web Forms :: Images Path Upload And Display Through Stored Procedure

Mar 20, 2012

How can i upload image to a folder and its path to my database using stored procedure?

And similarly i want to retrieve images from database using their paths stored in database through stored procedure...

View 1 Replies

Crystal Reports :: Display Images With Path Stored In Database

Oct 19, 2013

How to display images in crystal report from database am inserting address (image folder) of images into the database, not inserting images into the database...

View 1 Replies

Web Forms :: Images Are Not Uploaded Correctly To Server Path Of The Application Folder?

Dec 24, 2010

I have a task to upload multiple images to server path of the application folder . I have used the File Upload control in order to Upload the Images to server path but some images of about 778 kb are not supposed to be uploaded correctly. And while displaying the Images I am using Datalist control.

While I have tried to upload from Application in my system all files got uploaded but while acessing the link some files are not getting uploaded.

View 1 Replies

Data Controls :: How To Store Image Path In Database And Then Access Images

Jun 18, 2013

how to storethe image path in database and how to access image from database in asp web form

View 1 Replies

Data Controls :: Export GridView With Images To Excel - Image Path?

Aug 21, 2013

[URL] ...

In above website,You have stored imagepath as Image/file.jpg. I have created a database and stored image as "~/Images/File.jpg" and then how should i show that image in excel.pdf from gridview.

When i an making this method

protected  string GetUrl(string imagepath) {
    string[] splits = Request.Url.AbsoluteUri.Split('/');
    if (splits.Length  >= 2) {
        string url = splits[0] + "//";
        for (int i = 2; i < splits.Length - 1; i++) {
            url += splits[i];
            url += "/";
        } return url +  imagepath;
    } return imagepath;
}

Its not working for me..I want to export gridview data in excel/pdf but my image in database in like "~/Images/file.jpg"..

View 1 Replies

Web Forms :: Crystal Report - Dynamically Display Images Stored On Server From Path

Sep 19, 2012

I have created 1 report in my web site (EmployeeDetail.rpt) using inbuild crystal report .

Now I wanted to display image of respective employee(s) according to selection(department wise)

I tried everything but it did not work.

(I have uploaded and stored images on server in EmpImages directory empID wise)

How to achieve this ?

View 1 Replies

Data Controls :: Display Images In GridView Using Path Stored In Excel File

Oct 7, 2013

how to read the image from excel shhet if i have foder which contain images .

so i want to dispalying image from excel shhet

.how can i do this wheather how can i assign the path of image/foder in excel shhet

View 1 Replies

MVC :: Error - The Layout Page "/Shared/_Layout.cshtml" Could Not Be Found At The Following Path....

Mar 15, 2011

I'm attempting to access a layout page in an MVC page like this:

[Code]....

The problem is that I get this error:

he layout page "/Shared/_Layout.cshtml" could not be found at the following path: "/Shared/_Layout.cshtml".

Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: The layout page "/Shared/_Layout.cshtml" could not be found at the following path: "/Shared/_Layout.cshtml".Source Error:

[Code]....

Stack Trace:

[Code]....

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

Not sure why this is a problem, I was referencing this page:

[URL]

View 3 Replies

DataSource Controls :: Saving Images To A Server Folder With Different Category Names And The Path To A Database?

Jan 19, 2010

Here is what I am basically trying to accomplish I want to upload images to the server separated into categories and save the file path into the database. I have found plenty of documentation on saving to a file and the file path to a database. But, I haven't found anything that will allow me to seperate the images into categoies.

I have made three tables in the database

[code]....

What I am trying to do is create a gallery for our clients to browse and download different vesions of posters and ad cards.

View 15 Replies

C# - Using Grasp Controller With MVC Controller - How To Make An Object Always Visible For A Controller

Dec 28, 2010

UML and Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development, that follows the UP(Unified Process). It uses a Grasp Controller pattern to interact with domain classes by some methods like NewSale(), AddNewItemToSale() and CloseSale. In windows form, I can instantiate a object of this class in the UI and then use its methods to perform the actions. This works well in Client apps, but when I use asp.net mvc, I cannot find a way to instantiate an object (one for each user) that was always visible for a Controller (MVC). I cannot insert as an attribute inside Controller because it always create a new one.

View 1 Replies

C# - Is It Safe To Access .net Session Variables Through Static Properties Of A Static Object

May 10, 2010

Is it safe to access asp.net session variables through static properties of a static object?Here is what I mean:

public static class SessionHelper
{
public static int Age
{
get
{
[code]...

Is it possible that userA could access userB's session data this way?

View 2 Replies

C# - How To Lock A Private Static Field Of A Class In One Static Method

Mar 26, 2011

I have a private static field in my Controller class in an MVC web application.

I have a static method in that controller that assigns some value to that static field, I want to apply lock on that static field until some other instance method in the controller uses the value stored in the static field and then releases it.

DETAILS:

I have a controller named BaseController having a static ClientId field as follows and two methods as follows:-

public static string ClientId = "";
static void OnClientConnected(string clientId, ref Dictionary<string, object> list)
{
list.Add("a", "b");
// I want the ClientId to be locked here, so that it can not be accessed by other requests coming to the server and wait for ClientId to be released:-
BaseController.clientId = clientId;
}
public ActionResult Handler()
{
if (something)
{
// use the static ClientId here
}
// Release the ClientId here, so it can now be used by other web requests coming to the server.
return View();
}

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved