asp.net-mvc-2

Multiple relationships with lookup tables in Entity Framework

The context of the question is ASP.NET MVC2 / EF4. I have a number of lookup tables in the database which have previously been programmatically referenced, each from a number of other tables... So there might be a country table with country-id shortcode, desc, and half a dozen tables that have a countryid in them. Repeat for 5 or 6 other...

ASP.NET - Trapping client disconnections on long running HTTP requests

Hi all, I have a long poll HTTP request using ASP.NET 4, MVC 2 and AsyncController. If a user closes their browser and kills the HTTP connection without the request completing, I'd like to know about it and completely clean up after them. If I don't, the open and incomplete requests just sit there and eventually IIS stops accepting new ...

how tp populate image in asp.net MVC 2

Hi, I am saving the user image in application domain file system. and storing path in database. I am getting the path in my User.PhotoPath property. I want to show image on page of this photopath . how to shwo it. I am using the asp.net MVC 2 + C#. Please guide me I am new in this environment. ...

Generate a rdlc Report using an Object not a Table or View

Hi All, I am creating a ASP.NET MVC 2 application where I want to generate a PDF report I have this code in my Report controller: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using System.Web.Mvc.Ajax; using System.Text; using System.Linq.Expressions; using Microsoft.Repor...

How to catch event data on click event in fullcalender using asp.net mvc

I am using fullCalendar and I'm able to populate the calendar with events very easily. And I undertsand the best way to add events to the calendar is through the database. What I need now is to catch and populate an edit event form after the user clicks an event. How would I do this when I am using asp.net mvc 2? ...

ASPNET MVC: ow can I make a page located in a given area (as opposed to the root structure) as default?

Hello, How and where do I configure my application so that, when it launches, the action (thus the page to be displayed) be, not in the root structure, but rather in a given area of my choice? Let's say, Action = "IndexOfArticles", Controller = "Articles", Area = "News". I want this setting to be the default when I launch the applicat...

Checkboxes not working with MVC 2 editor templates and IE8

Iv created an editor template for the boolean type. And it works fine in all modern browsers expect IE8 where any value changes seem to be lost when they are posted to the server. I have read there are 'issues' with MVC checkboxs retaining their values, and as a result the Html.CheckBox helper includes a hidden field on the page to sto...

Can't figure out why this MVC2 route doesn't work

I'm trying to create an ASP.NET MVC2 route with a regular expression constraint to filter language names (like en-us, pt-br) but unfortunately it doesn't work. Have a look: routes.MapRoute( "Culture", // Route name "{culture}", // URL with parameters new { controller = "Home", action = "Culture" }, // Parameter defaults ...

DropDownListFor does not set selected value

I have a view that is displaying a Drop down list using the HTML helper DropDownListFor <%: Html.DropDownListFor(Function(model) model.Manufacturer, New SelectList(Model.ManufacturerList, Model.Manufacturer))%> My controller is passing the View a ViewModel containing the Manufacturer and the ManufacturerList Function Search(ByVal ite...

How to defend against hacking if a user submits XML

I have a feature where users can submit pure XML in a form. When my server gets the response I will validate it against a XML schema then I store it in the database. I never show the XML on a webpage unless it is in a form for editing. I use the XML to render html forms or text in a webpage and I will encode the text and never show the a...

ASP.NET MVC Routes Mapping issue

Hi guys, I am struggling with generating outbound urls in asp.net mvc 2. Here is the scenario. Controller: MoveController Action: Index() View: Index.aspx Now what I would like is to have multiple urls mapping to same controller (MoveController) and action (Index) with different parameter (locationId) value e.g. url -> Rout...

ASP.NET MVC 2: Avoiding loop when accessing 404 action directly

Like many people using ASP.NET MVC, I've implemented my own custom 404 error handling scheme using an approach similar to the one described here: http://stackoverflow.com/questions/619895/how-can-i-properly-handle-404s-in-asp-net-mvc/2577095#2577095 (I actually discovered that post after implementing my own solution, but what I came up ...

Where to write Database and Business logic in MVC?

Hi All, As I am learning and working on Asp.Net MVC application, I want to know that what is the better place to write Business Logic and Data Access logic in MVC. Where should I write DataAccess and Business Logic among three layers (Model, View and Controller) ?? Could anybody please tell me the correct way to write the code for thi...

NHibernate Contextual Sessions in ASP.NET MVC

I want to use NHibernate's Contextual Sessions in my ASP.NET MVC 2 application, but I'm having a hard time finding guidance on how to properly do this. I'm interested in Session per request. ...

Asp.net mvc 2 Search form in Partial View

Hi could someone make a small example for me. I wanna create a partial view with a textbox and a submit button. When the user hits the submit button, I want to redirect to the following url /Search/SearchQuery/ UPDATE //This is my searchBox.ascx <% using (Html.BeginForm("Index", "Search", new { area = "eCommerce" }, FormMethod.Pos...

Asp.Net Mvc: Cannot access my models namespace from my view

So I have a ViewModel in the 'models' folder of my Mvc project with a namespace of 'Web.Models' (My Mvc project is called 'Web') I think its worth mentioning I have 3 other projects in my solution: Domain, Test, and Tasks. The view model is assigned properties from classes in my Domain.Entities folder. I can create a new instance of my ...

Reflect Over List of Controllers

Hi - I'm a bit new to reflection in c#. I'm trying to generate a list of all controllers in order to test whether or not they are decorated with a specific actionfilter. When writing unit tests, how do you access the tested assembly? This does not seem to work: var myAssembly = System.Reflection.Assembly.GetExecutingAssembly(); ...

ASP.NET MVC2 User Control JQuery problem

Hi! I want to make my own authorization for my asp.net mvc2 application, I want to use the default LogOn user control, I add this code to user control: <a id="log_in" href="#">log in</a> <div id="dialog" title="Please sing in"> <p>Login:</p> <p><input type="text" /></p> <p><input type="text" /></p> ...

What's wrong with this linqTOsql self referencing object mapping?

Hey there, I'm trying to create a self referencing object using linqTOsql mapping. So far, I am definitely in over my head. Here's the code I have: [Table] public class Category { [Column(IsPrimaryKey=true, IsDbGenerated=true, AutoSync=AutoSync.OnInsert)] public Int64 catID { get; set; } public Int64 parentCatID { get; set;...

How to change HTTP protocol for HTTPS on a MVC2 application???

I have an application developed on MVC2 but I need it to change from HTTP to HTTPS after authentication. How do I manage that and where do I have to put the code? Thank you, Ignacio ...