asp.net-mvc

Cant get elmah to send email with MVC

"The specified string is not in the form required for an e-mail address." I get the above and then it looks for source. The email address is fine and I have the module in place. Errors are being logged fine. WHat else can be going on? ...

asp.net MVC antiforgerytoken on exception RedirectToAction

hiya I have implimented the AnitforgeryToken with my asp.net MVC forms, and also added the attribute to my login procedure, however when the check failes i wish to redirect to my fraud action rather than an exception page. is this possible within the attribute ???? thanks ...

I am trying to use openid for my website. Can someone please point me to a asp.net mvc working sample that uses openid

Due to lack to time i cannot dig google and get information about openid and then implement it. Can someone please point me to a working asp.net sample that explains how openid works with asp.net mvc. Thanks. ...

asp.net MVC confused by custom attributes creation

hi i am trying to create a custom attribute for my MVC application so that i can call [CheckLogin] this is to check my cookie as i am not using forms authentification. i have created a class CheckLogin and this is in my App_Code folder and the code is as follows: using System.Web.Mvc; using System.Attributes; using System.Diagnos...

asp.net MVC ddd DRY vs loose coupling and persistance/data access layer

So as I understand it with good loose coupling I should be able to swap out my DAL with a couple lines of code at the application root. I have 2 DAL written, Linq-to-sql and a JSon file repository (for testing and because I wanted to try out the System.Web.Scripting.JavascriptSerializer). linq to sql will create entities instead of my ...

Considerations for changing a page's URL in a CMS

I have written a CMS for a website. You can create pages and do all things you would expect but I am just wanting your opinions on what to do if a user changes the URL of a page. You would need to do a 301 for the previous stored URL but if the user changes the URL 10 times you have to account for all those changes. Therefore do you n...

How can I unit test views and authorization attributes of my asp.net mvc application in nUnit?

I'm at a point where I'd like to start writing unit tests for my MVC application. I've already figured out how to unit test the controller and I can unit test my underlying business libraries without any problem. I'm coming unstuck on a couple of items though: How do I unit test my views? That is, after a controller has returned the...

Can ASP.Net MVC routing account for a "OR" option?

I have this routing setup at the moment routes.MapRoute( "OldPages", // Route name "page{id}.html", // URL with parameters new { controller = "WebPage", action = "Details", pageName = "oldpage", moreInfoID = 0 }, new { action = "Details" } ); ...

css/images not showing when hosting ASP.NET MVC in IIS on Vista Home Premium

Hi all, my css and images are not showing when hosting ASP.NET MVC in IIS on Vista Home Premium. Works fine when hosting through Visual Studio. Pool is Integrated, static content is checked for IIS install, not sure what's going on. I'm trying to hit my site from Virtual PC to test in IE6. Prefereably I could test it from the host ma...

Correct Controller code for a 301 Redirect

I am designing a new dynamic site from a static site. I have the route all sorted but I have a question on my Action method. Below is the code but when testing and looking at the headers that Firebug reports, if I take out the Response.End it is a 302 redirect I assume because I set the 301 but then call another action which makes it a...

Seemingly simple MVC partial view question

I am trying to display my data (images) in two columns of a table in my partial view. The code below does not seem to work as it displays each image in its own row. What am I missing? <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %> <%@ Import Namespace="ULS_Site.Models"%> <%var alternating = false;%> <table> <% f...

Problem using OrderBy with the entity framework and ObjectContext.CreateQuery(T)

Hi, I'm having troubles using this method: public ObjectQuery<E> DoQuery(string columnName, int maximumRows, int startRowIndex) { var result = (ObjectQuery<E>)_ctx.CreateQuery<E> ("[" + typeof(E).Name + "]").OrderBy(/*???*/).Skip<E>(startRowIndex).Take(maximumRows); return result; } I'm not sure what needs to go in the ...

Using WatiN through MbUnit to test ASP .Net MVC web application

I am trying to apply some WatiN UI tests to my new ASP .Net MVC application, running the WatiN tests through MbUnit, but am having some difficulties. If I follow the instructions (exactly) on this page, then the google homepage loads, up the text is inserted, the search is done and the test passes. (no problem here). However, when I si...

Troubles creating a proper lambda expression...

This is the code I need to alter: var xParam = Expression.Parameter(typeof(E), typeof(E).Name); MemberExpression leftExpr = MemberExpression.Property(xParam, this._KeyProperty); Expression rightExpr = Expression.Constant(id); BinaryExpression binaryExpr = MemberExpression.Equal(leftExpr, rightExpr); //Create Lambda Expression for the se...

Asp.Net MVC RenderPartial different model

I got a view that inherits : System.Web.Mvc.ViewPage<IEnumerable<MyProjects.Models.MyAccountWrapper>> In this view I list data about the object MyAccountWrapper. This object contains a list of Account. Like this MyAccountWrapper.Accounts What I would like in this view is to be able to create an account. So I Try <% Html.RenderPartial(...

How to timeout a user in asp.net formsAuthentication

Hi I am wondering how do I set a timeout for a user if they don't do any requests after say 10mins there session is killed and they are logged out. I have in my webconfig this <authentication mode="Forms"> <forms loginUrl="~/Account/LogOn" protection="All" timeout="20160" pat...

Why does this only work in Firefox? Rendering Of Asp.net MVC partial View and passing result back through ajax

Hi Basically I have this In my Asp.net controller public ActionResult RenderMyView() { data = // some data to used in rendering my partial view return PartialView("PartialView", data); //edit I also return a json result if an error occurs. Say if I get an SQLException I will return a json result back and not render any part...

Static files (.js, .css) triggering ASP.NET pipeline.

In my ASP.NET MVC application the ASP.NET pipeline is being invoked for static files (such as css and javascript files). This shouldn't be happening, right? (I mean, what's the point in processing them?). Maybe I'm completely wrong here, and ASP.NET should be processing these files - If so please let me know! Otherwise, What's the be...

MVC Complex Model Binding

I would like to do complex validation on my form that contains a list of objects. My form contains a list of, let's say, MyObjects. MyObject consists of a double amount and a MyDate which is just a wrapper around DateTime. public class MyObject { public MyDate Date { get; set; } //MyDate is wrapper around DateTime public double...

Is there any Image Uploader for ASP.NET MVC?

Is there any free image uploader control for ASP.NET MVC? Thanks. ...