asp.net-mvc

Is the combination of ADO.NET Entity Framework and ASP.MVC wrong by any chance?

I have one solution with three projects. DomainModel (C# Library with ADO.NET Entity Framework) DomainModelTest (Unit Testing for Business Logic) WebApp (Using DomainModel) For some reason, I cannot even bring the view if I pass any of the objects in the DomainModel, not even simple. I get the error below: Any ideas? Compiler ...

Injecting a string into a javascript on an asp.net mvc view

I have a view that contains a javascript function that i need to init/call when the page loads. The method is static but it needs to be called with some parameteres (a list of Id's) - this list is dynamic and varies by some querystring parameters (i can not generate the list clientside from the querystring). So i need to generate this l...

What can be set in the FormsAuthenticationTicket?

Hi I am still a bit confused about something about FormsAuthenticationTicket and the actual cookie container. What does DateExpiration in FormsAuthenticationTicket() refer to? Is that when the cookie dies? Is that how long the user can stay logged in without any active actions (i.e. timeout)? <forms loginUrl="~/Account/LogOn" ...

How do you persist changes to objects returned from a LINQ query to the database?

So I load up an object like... MyObject object = new MyObject(); object = objectRepository.getObjectByID(id); object.lastLoaded = DateTime.Now(); ... //NOW WHAT???? I know there is a .Save() but does that update the current one or is that only used for creating new ones? ...

ASP.Net MVC ignoring filter order...

Hi guys Just wondering if anyone has any idea of why my filter order is being ignored... [AcceptVerbs(HttpVerbs.Get)] [Compress(Order = 1)] [EnhancedOutputCache(Order = 2, Duration = 5, VaryByParam = "true", Location = OutputCacheLocation.ServerAndClient)] public virtual ActionResult Index() { return View(); } public class Compr...

JavaScript callback urls in .js codebehind files in ASP.NET MVC

When we have a .js file which we reference from a View page and then have URLs in callback in JS file we run into problems with urls not being resolved when running site either on VS 2008 integrated webserver or on IIS7. For example, we have this piece of code in JS file pending.createCallback(pending.webRoot + "../../WidgetZone...

MVC data annotation layer: where to put the set CurrentUICulture statement?

Hi, I am getting crazy with the localization of an MVC application. After a recent question of mine I have followed this approach: The language is stored in Session["lang"] Each controller inherits from my own BaseController, which overrides OnActionExecuting, and in this method reads the Session and sets CurrentCulture and CurrentUI...

ASP.NET MVC and ASP.NET membership provider - Handle authentication globally

Hi, I'm building a small app with ASP.NET MVC and I'm using the ASP.NET membership provider for handling users. Hooked this up to the login page of the basic MVC template. What is the best practice for checking a valid authentication globaly? I basically want to redirect to the front page or the login page if the user's not authenticat...

HTML Checkboxes in select list

I'm trying to build a checkbox list within a select list (like the one for countries here: link text) I'm using Asp.net MVC so it needs to be pure/html &| javascript/JQuery. Is this possable? Or is there already a prebuild one I could download load? Thanks Ripped HTML/CSS: <html xmlns="http://www.w3.org/1999/xhtml" > <head> <style ...

ASP.net MVC project not compiling on IIS

I used to just upload asp.net websites to the live server, and IIS compiles them automatically. But when I do the same with asp.net MVC projects I just get errors, and I need to release Build the project before I upload it. Note1: I'm using VWD 2008 Express Note2: The project is working perfectly if I release build it on my machine th...

Handling HttpException from jQuery Form ajaxSubmit() method with ASP.NET MVC

Hello, I have a file upload form which makes use of the jQuery Form plugin to upload 3 files via the ajaxSubmit() command. Success and Error Callbacks are provided to ajaxSubmit() to display the result in a <div> to the user. When the uploaded files cause the Request length to be exceeded the MVC framework throws an HttpException, and...

Accessing ASP.NET MVC model data from with Javascript

Hi, I have a strongly typed View that accepts a Customer model, this customer model is a LINQ2SQL partial class that has a property called Journeys which returns all Journeys that are associated with this Customer. I was wondering if it would be possible to access the Customer.Journeys property as a JSON object from within the Javascri...

Where to Authorize Access to a Controller

Hi All I have the following Filter on my Controller: [Authorize(Roles="Admin")] public class AdminOnlyController : Controller { // stuff } I showed a couple of guys here at work what I'm doing, and a huge debate emerged with some of the guys claiming that Authorization should not be a responsibility of the Controller. This is th...

form authentication info in asp.net mvc

i'm using asp.net mvc form authentication and storing thro' setauthcokkie(); how can i get the logged in user information in my index or any controller. ...

MVC more than one form to submit

I have a standard Edit form view within MVC, and I need to place a user control, in this case Create inside the BeginForm, like below: When the issue is that the Create ascx when the form is submitted does not fire it's action in the controller, what am I doing wrong? <% using (Html.BeginForm()) {%> <fieldset> <legend>Tax</legen...

Putting an ID on <body> in ASP.NET MVC

I would like my views to be able to specify a class for the <body> tag, which lies in my master page. My first take was to do something like this: <asp:Content ContentPlaceHolderID="BodyClassContent" runat="server"> view-item</asp:Content> However, that would require this in the master page, which doesn't work: <body class="<as...

how to get the resulting HTML from a MVC action?

Is it possible to get the resulting HTML that is outputting from an action via code? ...

Using ADO.NET Entity Data Model, how do I pass (or set) the connection string password?

Hello SO: I am working with the ADO.NET Entity Data Model for this side project I am working on. Typically I would include the whole connection string (user and password) inside the web.config, but I was feeling frisky this morning so I decided to exclude the password from the connection string. Unfortunately for me, I cannot seem to fi...

asp.net MVC - complex example?

We're evaluating asp.net MVC and are looking for some more complicated examples over and above NerdDinner. Specifically, in a more complex web app, I might have a navigation bar (including primary nav, a search box and a log-in status display), a main content area, a sub-content area (including related content) and a footer. In MVC a c...

ASP.NET Mvc Request.Url.Host in Helper method

I am trying to convert a user control to a helper method in Asp.NET MVC. However I do not seem to be able to have access to Request.Url.Host how do I get the correct host. ...