asp.net-mvc

MVC 2, Entity Framework 4. Custom Generic Query. Where I put the code?

Here is my problem, I have a multilang database shema. First I want a query with this result French | English Car | NULL Etoile | Stars NULL | Monkey ... I'm pretty sure I will need to use A left join combinate with Pivot table. Where I'm suppose to put this query. In a Partial class, or I need to use the Repository Pattern to...

ASP.NET MVC routing and file path

I have a controller action that has the same name as a file path. Like: www.example.com/userfiles/path/to/userfile.jpg Basically I have a userfiles controller and on the index action everything after userfiles/ is a path. There is also a userfiles virtual directory in the root of my application. What I want to happen is that if the di...

How do I publish/deploy an MVC Project with ResX Resources?

I have written a VERY simple MVC application which just displays a single string from a Resource file. It works just fine on my local machine but when I deploy the project to the web server I get the error. CS0103: The name 'Resources' does not exist in the current context You can very easily replicate exactly what I am doing in...

How can I RedirectToAction within $.ajax callback?

I use $.ajax() to poll an action method every 5 seconds as follows: $.ajax({ type: 'GET', url: '/MyController/IsReady/1', dataType: 'json', success: function (xhr_data) { if (xhr_data.active == 'pending') { setTimeout(function () { ajaxRequest(); }, 5000); } } }); and the Actio...

Razor Compilation Error

I have the following section of Razor code and it fails during runtime with a compilation error: @foreach(var stat in Model){ <li> @stat.EffectiveDate.ToShortDateString() - @stat.EventType.Description <br /> TimeTaken: @if (@stat.TimeTaken.Hours > 0) { @sta...

Security problem when logging off and navigating to '/controller/action'

I am using ASP.NET MVC2 and have a problem. After Log off I manually type into the adress bar http://localhost/controller/action and I'm redirected to the page regardless of what I am LogOff . How do I solve this security risk? Code of some controller action who I am manual type on adress bar: [Authorize(Roles = "Admin")] public Action...

ASP.NET MVC: Javascript executing correctly on create view, but not edit view.

I have two views: create and edit. Both share a strongly typed editor template user control. I have a jQuery wysiwyg editor on the shared editor template, and it works fine without errors on the create view, but when I load up the edit view, firefox reports that "$ is not defined" "jquery is not defined" etc. Also, the images from th...

Is it possible to host an ASP.NET MVC2 website from a windows service?

I have a .NET 4 application that runs as a windows service. It runs periodic tasks and provides WCF restful webservices. It already hosts a silverlight web page (via WCF) that allows a user to configure the service. Now I have a requirement to provide information on HTML/java script pages (e.g. for browsers and platforms that don't su...

ASP.Net MVC reusable form as RenderAction or RenderPartial

I'm looking for a best practice for embedding a form on multiple pages as a partial view. I have a contact form I'm looking to embed on multiple pages on a site. Usually, the form would be on a contact page and the contact model could be the model for the view and use data annotations for validation. However, the view is already strongl...

Updating an Asp.Net MVC Database from a microcontroller

I've created a Asp.net MVC web application that has a SQL Server attached to it. I would like to update the database on an action (in this case a physical card swipe). I have a microcontroller that stores the identification number and then can connect via tcp to the site. What is the best approach for allowing the microcontroller to ad...

ASP.NET MVC - Search Criteria as Route Parameter in stead of querystring - Illegal Characters

I asked a previous question on how to optimize my search for SEO and users without JavaScript, and I figured out my answer by using RedirectToAction However, in doing so, I've found a new issue that I need to resolve. If I submit a search "the quick brown fox jumped over the lazy dogs" (trying to mimic Google with the "quotes" fo...

Best design pattern for associating subdomain with area and PRG pattern?

Now that the next version of ASP.NET MVC is being prototyped and previewed (ASP.NET MVC 3 Preview 1 came out a couple of weeks ago), I wonder if we should call the attention of the Core Dev team (S Hanselman, Phil Haack and all) to this "feature." Is there a easy/non tacky way of associating subdomains areas? Something like: http://a...

Why is there no intellisense in ASP.Net MVC 2.0 when assigning Model values to JavaScript?

I'm trying to add some Model properties into my JavaScript within my content page: $(document).ready(function () { createPager(1, <%=Model.TotalPages %>); createUnprocessedPager(1, <%=Model.TotalUnprocessedPages %>); }); Does anyone know if this is by design? Are you not meant to combine Model properties with JavaScript? Or is...

reading a weird format .mvc

I am doing some custom development for a client on their miva shopping cart site and the format is .mvc The site appears to mostly have this format and I have no idea how to read it. Any ideas ...

Can't seem to wrap WMD Markdown Editor inside JQuery Tabs

I'm trying to place a Markdown Editor inside jQuery-UI Tabs, but the editor is not being shown. <% Using Html.BeginForm()%> <div id="AddEventWizard"> <ul> <li><a href="#tabs-1">Event Title</a></li> <li><a href="#tabs-2">Event Description</a></li> </ul> <div id="tabs-1"> ...

Quartz.Net embedded into Asp.NET MVC2, not firing off jobs

I'm trying to get Quartz.net working by embedding into my .Net MVC2 application. I know this is not ideal, but I'm just trying to get it up and running before moving it over to a service. I can't get my jobs to fire off, but I think I'm configured correctly. In my Global.asax.cs: protected void Application_Start() { Quartz.ISchedule...

How to create customaizable profile like igoogle using ASP.NET MVC?

I can create darg and drop by jQuery but I can't store and load again each user profile. ...

Return view from different area

Hello, I've got my ASP.NET MVC 2 application divided into few areas. One of them is a default area in main catalog, the other is Account area in Areas catalog. Now the problem is, that I need to use the same view in controllers from both of this areas. Now If they would be in the same area I will just return View("ViewName") and it's o...

How can I render an image in asp.net mvc?

I have a sample I'm building, that's using the Northwind database. I have a view in which I show all the products for a specifc category and use a ul to generate items with an image and the products name and price. I have used the code here, http://blogs.msdn.com/b/miah/archive/2008/11/13/extending-mvc-returning-an-image-from-a-controll...

MVC Post Json Error

Hi, I'm try to issue a post to a MVC action and displaying the resulting JSON on the web page. The action receives the post command but the result is showing up on a new page, instead of the same page. For example, it'll ask if I want to download or open the file. PS. I'm using jQuery validate as well. my jquery: submitHandler: functio...