asp.net-mvc

FormsAuthentication.RedirectFromLoginPage does not return me to orignal URL

I reach my login page with the parameter "returnUrl" set to the URL I was on. Then, I login via OpenID (DotNetOpenAuth), and call FormsAuthentication.RedirectFromLoginPage(). The login is successful, however I am not returned to the original page I was on. I'm having the same problem on logout - when I log out I don't remain on the same...

Sharp Architecture Validation Client/Server

I have a client server application using Sharp Architecture as a base. The application uses WCF services for the client-server calls. I pass DTOs between the client and the server converting them on the server. I want to validate my domain objects but am unsure of how best to pass the validation results from the client to the server...

asp mvc design question: single view for multiple data types

In my database, there are maybe a dozen tables that represent lookup types (All have ID and Name columns - No, they must remain as seperate tables, won't be normalized into one table). I'm building an administration application, where I want an administrator to be able to add/edit/delete/list all of these lookups. I know I can re-use t...

How to pass information from pop-up window / modal window to base window in ASP.NET MVC

I'm writing a contact form in ASP.NET MVC. The user will have the ability to attach regular files (using normal file / browse functions) as well as the ability to search for a particular person and attach files related to that person. The first part is simple enough, but the second part is what's giving me headaches. For the second part...

ASP.NET MVC: Adding custom ErrorMessage that incorporates DisplayName to custom ValidationAttribute.

I am using ASP.NET MVC with DataAnnotations. I have created the following custom ValidationAttribute which works fine. public class StringRangeAttribute : ValidationAttribute { public int MinLength { get; set; } public int MaxLength { get; set; } public StringRangeAttribute(int minLength, int maxLength) { thi...

ASP.NET MVC app restarts itself

We are encountering an issue where our ASP.NET MVC app is restarting for an unknown reason. The cause of the shut down is "A subdirectory in the Bin application directory was changed or renamed." The file in question turned out to be C:\Users\Jason\AppData\Local\Temp\Temporary ASP.NET Files\root\f691a68c\a1593a1e\hash\hash.web. ...

Changing ActionExecutingContext values in Custom Filter Attribute

I have a custom filter attribute that I want to use on certain ActionResults to look at the data being attempted and to set values where certain rules are violated. So; public class SpecialActionFilter : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext filterContext) { foreach (strin...

How can I automatically refresh a partial view?

I have a simple view: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage" %> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> Administration </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <h...

Nice looking xhtml/html when I "View Source"?

I'm just curious if anyone has any tricks on how to keep source code looking good when you "View Source." I'm militant about keeping my code well formatted and spaced while I'm developing and I tend to "View Source" a lot to double check the output (when firebug is overkill). When I start using RenderPartials and RenderActions and anythi...

ASP.NET MVC + Castle ActiveRecord + elmah on Mono 2.6 on windows 7

I am trying to get xsp2 to run my asp.net mvc application, but I get the attached error message with no debug information. Nothing useful is produced if I run xsp2 with --verbose. The app runs fine under IIS on Windows Vista and Windows 7 and VS's built in webserver. I know others have had success with this, so I'm hoping that I just...

Serialize and Deserialize Date between ASP.Net MVC and ExtJS

I've been searching through the web to look for a solution for this but still stuck. I'm having difficulties serializing DateTime object. The standard serialize using DataContract will give this result \/Date(1262600239000)\/. After Ext.encode the result changed to /Date(1262600239000)/. The result from Ext.encode is not readable in Ext...

Stymied by ASP.NET Compilation Error CS0009

I'm getting error below when I debug my ASP.NET MVC app. Any thoughts on how I could solve this? Any idea how the problem would have occurred in the first place? I promise you I didn't go randomly deleting dll's from deep within protected directories on my system. Server Error in '/' Application. Compilation Error Description...

JSON post works in IE, not in FF

I have an asp.net MVC app. One of the forms posts json data to a public method (not an action, perhaps it will be later) on the controller. This works great in IE 8. However, it does not work in Firefox 3.5. The view is a list of jquery sortable objects inside of a form. Here is a stripped down version of the form: <form class="c...

Confused about ASP.NET MVC

Hi, I have a database table called "Warehouse" this Warehouse's linked to a "Product" table (1 to many relationship). How do I in ASP.NET MVC: Create a warehouse view/page with the total number of products in this warehouse displayed On the same view/page display the product id and name and qty as textfields (allow editing) prepopulat...

who does the validation in basic asp.net mvc + entity framework program

I have a very simple ASP.NET MVC application with Entity Framework-based model. Essentially, just a Product table from AdventureWorks database. Controller only has Index and CrUD methods. Create has the following: if (!ModelState.IsValid) { return View(); } // Save to the database Some of the field...

Displaying data from multiple tables in a view as a list - ASP.Net MVC

Hi, I have the following two tables (basic outline): Tbl_CategoryType ID LevelID Description Tbl_Levels ID Name Basically, I want to present all of the information in the Tbl_CategoryType table while referencing the Tbl_Levels.Name data based on the Tbl_CategoryType.LevelID number. I have tried using a join in my repository as below...

Best practice to set/get information about whether user is logged in or not.

I know similar questions have been posed before, but I could not find a duplicate that handles ASP.NET MVC (and the controller aspect) specifically. My question is as follows: In a MVC model, my understanding is that the controller should handle the use of HttpContext to determine who is logged on, if any. This is so the controller can...

How masterpage get the current page from masterpage by itself

I am writing a website with Visual Studio 2008, C# 3.5 and ASP.NET MVC 2. I put the navigation bar in the masterpage.But there is problem that I will not know which button is needed to be highlight(current page) in the navigation bar. I want get the current page that need to be highlight by masterpage self (not through the content page)...

ASP.NET MVC output cache for multinenant application, vary by hostname and culture

I have a multitenant application in ASP.NET MVC. The instance of the application that will be served is function of the hostname alone (something along the lines of stackexchange, I suppose). Each instance of the application might have a different culture setting (even "auto", to read the browser's language and try to use it), and will ...

How to bind comma separated list of values to List<...>

Let's say that I have field called Customers <input type="text" name="Customers" and I want to enter in it comma separated IDs of my Customers and then receive it on ASP.NET MVC side as a List. Is this feature build in ASP.NET MVC, if not what's the best way to do it? ...