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
Similar Messages:
Mar 23, 2011
I've researched this before asking, but all I can find is trivial apps that all use the same type of example. My first, of many, questions involves Controllers->Views.
Of all of the examples I have seen they always return one view. For example, the Home/Index control will return a view like so: return View(model); But, what if you need multiple views for the same page? Say you have to return two pieces of data, for other parts of the page, would you need to add all control logic in the single Index Controller View(), or can I add different ActionResults for the same page?
View 18 Replies
Jan 3, 2011
I know how to respond to a form post in ASP.NET MVC using jQuery, but I'm having trouble with something that is a little bit more simple.
The scenario is that there is a list of items on the screen, like an ordered list.
<ul>
<li>Item 1</li> // each will corrospond with an id.
<li>Item 2</li>
This is a crude example, of course, but the basic jist is that when the user clicks one, it will perform some server side logic... so in the controller, there is a method such as ..
public bool CheckSomething(int id)
{
// do some logic to determine if the result should be true
return true;
}
It's very simple logic, really - but it still requires database access, so I cannot do it in javascript. I need to have it hit my controller. The problem is that I want the UI to respond to this. how to exactly wire this up without using a Form.
View 2 Replies
May 20, 2010
I have 2 ActionResults both called Create which basically create different things on a model. Is there a way to have overridden action results? - I dont quite follow routing and not sure how to do what I'm trying to do.When creating A i call :-
AcceptVerbs(HttpVerbs.Post)]
public
ActionResult Create(ProjectModel
[code]...
View 1 Replies
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
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
Nov 6, 2010
my MVC2 delete and only my delete controller is refusing to return any class information. Its really similar to my edit function and the views are all auto-generated so I don't see the problem.
Function Delete(ByVal id As Integer) As ActionResult
View 4 Replies
Aug 16, 2010
I have a simple model where a Person has Gifts. I have a view which is a list of Gifts belonging to one Person.
My problem is with the Create action for a new Gift. I want it to default to the PersonID that we are already viewing the list of Gifts for. I tried simply passing the last PersonID (they are all the same)
Html.ActionLink("Create New", "Create", new { id = Model.Last().PersonID }) which works fine if there is already at least one Gift for that person but if this is the first Gift I don't have a value.
My Gift List controller knows the PersonID I want to pass but the view doesn't.
How do I pass this PersonID from my Gift List controller to my Gift Create controller via the Gift List view? Or is there a better way to do this?
View 2 Replies
May 30, 2010
I have a filter on my MVC web site. I display some records in a few different controller actions but when moving from one action to another I want to apply those filter values.
How can I persist values from controller to controller?
Should I use Session? TempData?
I am using Structure Map for IOC.
Maybe I could have a class that contains a Property for each Session Value that I use in my application and inject it on the controllers that need session?
View 10 Replies
Mar 14, 2011
How do you get the current action / controller name in a controller or class?
i can't show it in my view but that's not what i want.
View 1 Replies
Jul 22, 2010
C#: HomeController.vb: works fine HttpPost RsvpForm gets the object filled with user input.
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.Mvc;using RsvpInC.Models; namespace RsvpInC.Controllers{ public class HomeController : Controller { //
[code]...
View 5 Replies
Jan 24, 2011
I have a User entity and a department entity. I have a UserViewModel and DepartmentListModel which has List of departments.
UserViewModel has a property of type DepartmentListModel .
Now on user/create action I need to populate DepartmentListModel by calling DepartmentController's list action. List action returns populated DepartmentListViewModel.
From UserController how do I set DepartmentListModel ?
I tried doing so
[Code]....
But RedirectToAction returns RediretToRouteResult
View 7 Replies
Mar 31, 2010
I've been trying to get image caching working for the last 8 hours and I keep the same problem time and time again, I'm trying to cache Images at the moment and then when thats succesful, apply this to cache my js and css files. I have at the moment Sql Dependancy caching working on my dynamic pages but the page still takes to long due to images not caching.
What I have tried is going to IIS7 Management and adding HTTP Response Header for the images folder and setting various things for the cache control.i dont care how long it caches it on the client or on the proxy servers i just would like it to check when the file was modified and compare it with the one in the client or proxy cache and if they are different then fetch the new image which has been ftp up. i could solve this by changing the image name but the thing is the image name is generated when they are ftp'd to the site by an application and the name is a direct reference to the product so i cant change the name each time, as it would mean making a lot of otherpages accross the board.
so What i would like, is to set and expiry date of lets say 32 days or more on the images and then check to see if they have changed by date modified or some other way of checking(Etags maybe) I'm not sure, if they have changed on the server then redownload and recache them, I tried using post-check and pre-check together but that just permantly cached them, so when i change the image the only way it would display the new image is to just hit F5.
In Brief, how can i Cache images, on the client machine/ proxy cache and recache them when the modified date of the file has changed.
View 4 Replies
Mar 9, 2010
I want to show on one of my pages a slideshow type page. Basically I want it to show a selection of images from a folder and have the images scroll from right to left.
View 8 Replies
Jul 25, 2010
I want to write one program by visual studio 2008 (C# and ASP) that has web application and windows application.
I want to get clients images in web app(upload) and store them in DB (mysql) then send these images to windows app via web service (so i new web service, not web site). But i have 2 problems:
I have 2 ways to store images in mysql, first i should have BLOB field in DB -that it takes more space-, second i should save just name of each image in DB(so have image in one folder) -in this way i don't know how get image from clients and store them in that folder-. which one? Or what other? How (code) can i transfer image via web service(Byte[] or? ).
View 2 Replies
Apr 17, 2010
how to upload images to server(application/images folder) and retrive(display) from and on client PC for asp.net. its just for uplaoding logo directly to server folder and retriving from server to client. i am not getting server path on client pc for image.
View 5 Replies
Mar 15, 2010
i have the following scenario, i have a column of a gridview that shows me a text telling me is the user is allowed or not to access to some page, but now i just showing allow and deny, but i wanna show images that represent me the action, how can i do that?
View 3 Replies
Apr 29, 2010
[Code]....
i am using asp.net with c#, i have table images
shop nvarchar(50),
imgc image
imgo image
iam saving images in a database but while retreving it is showing blank images. i want to display as thumb nail images
View 1 Replies
Oct 31, 2010
I wanted to combine app_themes css files into one on the fly. I did so using Mads Cristensen technique. But now all elements that has background image defined through css (see picture) don't display image. I believe that is because css files are not relatively referenced anymore (../), but through axd file. I'm trying to fix this by changing reference to image files without success. I already tried background: url("~/App_Themes/44/images/myimage.gif") and this works for pages that combined css. But the problem is that there are other pages in this project that don't use this css combining and now they lost reference to background images.
View 1 Replies
Mar 11, 2010
Say I have several Areas that are baed on user roles.Differnet roles have different functionality, but also have some "shared" functionality like say "Payments"Now, I created a PaymentController (and it's views for listing, creating messages) in Shared (not an area) and it works fine.
Would it be possible (and how?) to create a PaymentsController class in one of the Areas, have that inherit the PaymentController Class in Shared?
If I can do this, I can successfully share common functionality across areas, and at the same time extend the derived controller to include some 'area specific' functionality to common shared controllers. (Such as the "REturn to xxxx" text and route of the returnurl, which are a bit more complicated than I just made it sound)
View 3 Replies
Apr 6, 2010
How to Display the treeview control with multiple images(each link should be with one image) instead of + images in asp.net
View 2 Replies
Jul 9, 2010
I'm using ASP.NET 4 Web forms routing, for example like this:
routes.MapPageRoute("page-browse", "{Language}/{Label}", "~/Default.aspx")
So the webadress could look like: http://localhost/mywebsite/eng/home
In the root of my website I have a folder "Images".
Image display works when I'm in the root of my website, e.g. by using http://localhost/mywebsite/default.aspx
But when using routing it doesn't work, because the image relative url will look at http://localhost/mywebsite/eng/images instead of http://localhost/mywebsite/images
Is there a way to prevent this using ASP.NET 4 Routing mechanism? Or is the only way to use absolute url's to images?
View 3 Replies
Jan 5, 2010
I'm using an HttpHandler to display images from memory ... which is working fine.The image is displayed as a .png format in a popup window.My problem is printing the image from IE7 Web Browser using the popup menu displayed after doing a right-click, selecting 'Print Picture'.A blank page is being printed ... i.e. No Image, just the url and date on the bottom of the page and the page number on the top.I have also tried this with the image formatted as .jpg, with the same result.
View 6 Replies
Jan 19, 2011
How can i transfer control to a controller's method from a controller's method..I am having two Controllers Home and User.. After username and password are verified inHome Controllers method , i want to show the User Controllers index page , so i have to callindex method of Home controller..How can i do it.
View 5 Replies
Jan 18, 2011
I know that HTML is client sided and ASP.NET is server sided. The question is should I use HTML or ASP.NET Images and whats the difference?What are the properties of ASP.NET images and what are of HTML images.
View 3 Replies