asp.net-mvc

What is keeping the users logged in after cookies are cleared in IE?

I'm having an issue where even after deleting the users cookies they are still logged in to my ASP.NET MVC site (IIS 6). HOWEVER, this only happens on my clients machine, my IE 8 on Win7 does NOT have this issue and the normal log out method works fine. It seems they need to close out the browser before it will release them from being ab...

Values from my login view also populate fields in my other views

When I login I enter my user name and password. On a different create view these values also populate the email address and the password fields. Why is this, and what can I do to stop it? The next 2 markups are my login view and my create view <%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.V...

ASP.NET MVC: Textboxes don't get highlighted when I access Modelstate.AddModelError Manually

Hello, Let's say I have this property [Required(ErrorMessage = "Add this property")] public string MyProperty {get; set;} When I use modelbinding validation like this UpdateModel(myModel); Then when there is an error the form is re-displayed, and the textbox representing MyProperty is highlighted (i.e. red borders and pink backgr...

ViewData["s"].ToString() vs. Request.QueryString["s"].ToString(), what is returned if "s" was never set?

If in my controller: public ActionResult Index() { //no code implied return View; } Then in the view that is returned: <%if(ViewData["SomeString"].ToString() != "True") {%> show this <%}%> I will get an error at runtime because of an object reference having no object. However inside of a page where I do: <%if(Request.Qu...

Why does the image not open in a browser?

I'm using the following snippet of code in an MVC Action to return an image in an HTML image tag: byte[] bytes = System.IO.File.ReadAllBytes(fileLocation); string fileType = "application/octet-stream"; FileContentResult fcr = new FileContentResult(bytes, fileType); fcr.FileDownloadName = fileName; return fcr; The image tag's src attri...

AJAX form submission using ExtJS and ASP.NET MVC

Hi all, I am working with ASP.NET MVC and have a view page with a simple text box and button to accompany it. I want AJAX to submit the form when the user clicks the search button. The response (search results) will be returned and displayed in a content div on the same page. I have done this successfully with JQuery, but I need the sa...

Pass model from strongly typed view back to a controller action - mvc2 VB.net

Hello hello. Here's what I have. I have an MVC application where all the data is tied together by VisitDate table in my database. The home page is a strongly typed view of type VisitDate, all it does is pull up some simple data. Now, here's where I'm having a problemo. I need a link that passes the current model in the view back to a sep...

Norm.MongoException: Connection timeout trying to get connection from connection pool

Hi, I'm using Rob's mvc startesite http://mvcstarter.codeplex.com/ with ASP.Net MVC 2, Ninject2, NoRM (http://github.com/atheken/NoRM) and MongoDB. It works so fast and the developpement is even faster but I'm facing a big problem, I at some points, get connection timeout. I can't figure out what I'm doing wrong. I already asked a que...

How do I pass a list of integers to an MVC action?

Can i use List or something? ...

ASP.NET MVC 2 Url Format Issue

I have a Visitors controller. Inside I have Index and SignIn actions. Here are the actions: public ActionResult Index(int month, int day, int year){ var visitors = visitorRepoistory.FindVisitorsByDate(month, day, year).ToList(); return View("Index", visito...

asp.net mvc int property bind exception

I have a int property in my class and want to validate if the user has entered a string. How can I do that using data annotations? When I pass a non-integer value I get a excpetion like this: The value 'asdasd' is not valid for property. Any Ideas? ...

Asp.Net MVC Routes - Handle Multiple routes with the same signature?

I'm interested to know how people handle the following situation. Assume we have a DataField and each DataField can have unlimited number of DataValues We have 2 controllers to handle the manipulation of these objects DataFieldController DataValueContoller Now if we ever need to add a new DataValue we need to know the ID of the Cus...

Getting Fluent NHibernate To Build Database tables

I am building an app with ASP.NET MVC2, Fluent NHibernate, StructureMap, and PostgreSQL. I am a total newbie when it comes to Fluent NHibernate. I got a setup going from a couple different sources but when I build and run my app it doesnt create the database tables for the database in my connection string. I have code in a few different ...

Some Asp.NET MVC2 Best Practices for managing fat controllers to a Business Service layer

Hello, My controllers are getting large and out of hand. A typical controller does the following: It determines whether a given user has access to a given resource. It validates the ViewModel. It translates the ViewModel into the DTOModel for persistence. It calls repositories to update/create new objects and associated other new obje...

MVC.net form post/anti forgery

When defining the ValidateAntiForgeryToken attribute. What level of complexity should be given to the salt? For example is an alpha-numeric over X number of characters characters good? Should there be symbols as well. [ValidateAntiForgeryToken(Salt = "How complex is good")] public virtual ActionResult SaveDetail(UserDetails details) { ...

Server application unavailable in a MVC2 application over IIS 6

Hello, I created an application pool, and i assigned to it a test application(simple 1 view that renders hello, one action and one controller ) that i made in MVC The thing is that when i executes as many times as i want it works, but after some hours (i dont know why), if i enter again into my server and i execute it, crashes. The ...

How do I use EditorTemplates from an AREA outside the current in ASP.NET MVC

Consider a project with 2 Areas. /Areas/Blog /Areas/Dashboard Now say that my Blog area has an editor for the type SpecialBlog. /Areas/Blog/Views/Blog/EditorTemplates/SpecialBlog.ascx What if a view that is part of my Dashboard Area would like to display a special blog? The following code works from Views inside the "Blog" Area but n...

MVC - Changing or adding a class for either 'Html.ValidationMessage' or 'Html.TextBox'

How do I change the class that is assigned to the control which is rendered by an MVC view by either the Html.TextBox or Html.ValidationMessage methods? ...

Should my ViewModel's constructor populate the ViewModel's data?

Should my ViewModel encapsulate the Services needed to populate it? Currently I'm doing it as follows: public PartialViewResult Companies(SearchViewModel search) { search.Summary = _entitySearchService.GetSearchDataSummary(search.SearchExpression); search.PagedCompanies = _companyService.GetPagedEntities<Company>(search.SearchE...

ASP.NET MVC 2 - DropDownFor -- Force user to select a value for a non-nullable type?

Hey all, I have (or so I think!) a simple problem. I will greatly simplify my model to speed this along. I have a model class lets call it item: public class Item { [Required(ErrorMessage="Must indicate if product is to be tracked by serial number.")] public bool TrackedBySerial { get; set; } } I have an "Add" view wh...