asp.net-mvc

In ASP.NET MVC, How do I make a partial view available to all controllers?

In ASP.NET MVC, How do I make a partial view available to all controllers? I want to create navigation that is common across the entire site, but when I place the Html.Action into my master page, it only works on views associated with 1 controller. Right now, I have a controller action defined like this: // GET: GetCategoriesPartia...

What is the web.debug.config and web.release.config file for?

Hi, I just upgraded to VS 2010 and MVC 2.0 and I noticed the web.config has two additional files attached to it? Are thee files used to specify debug and release specific settings, so you don't clutter up the main web.config? Does it even make sense to place a connection string in the root web.config file if I have have a local and remo...

stuff viewmodel into html.actionlink

Hi All, Is there a way to stuff my ViewModel into an Ajax.ActionLink? edit I'd like to take my 5 search fields on my page which are bind to a view model and send it along my .ActionLink as my object value parameter. Thanks, rod ...

ASP.NET MVC 2 Authorize ONLY unauthenticated users

im trying to figure out how to authorize only unauthenticated users. i have a sign in tab displayed in my site map and i only want it to show up when the user hasnt yet logged in. ...

How to state pattern with asp.net mvc?

Hi One question but I'm looking for two solutions: static dynamic Static means I know all states. Dynamic means I don't know states because end user can define it. Static How to create and organize views, viewmodels and actions? I know that state pattern is well suited for that scenario but how to pass data from view models and put ...

Logging errors in ASP.NET (MVC) through the Custom Error

In my web.config I have the following: <customErrors mode="RemoteOnly" defaultRedirect="/error.aspx"/> When an error occurs, the user is redirected to /error.aspx?aspxerrorpath=/somepage where I can get user's name, name of the page, date, but... I can't get the error message! I can get it via the OnException method, but then I won't...

Passing object(s) to a Controller Action

I'm attempting to use jQuery to do a $.post() to an MVC controller action. Here's the jQuery calls: var _authTicket = { username: 'testingu', password: 'testingp' }; function DoPost() { var inputObj = { authTicket: _authTicket, dateRange: 'ThisWeek' }; $.post('/MyController/MyAction', inputObj, PostResult); } f...

ASPNET MVC - Why is ModelState.IsValid false "The x field is required" when that field does have a value?

I have a model like this: public PurchaseOrder { [Required] [StringLength(15)] public virtual string OrderNumber {get;set;} // etc. } When I submit an order from the view (using $.post, not input type=submit) it goes to my controller class: public class PurchaseOrderController { public JsonResult Save(Purchas...

A very weird problem with localization (ASP.NET MVC)

I'm using Web Developer 2010. I just created a resource file lang.resx with different values in english. Then I created a lang.FR-fr.resx with French equivalents. However after tryingto compile, I get Error 131 Task could not find "AL.exe" using the SdkToolsPath "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\NETFX 4.0 Tools...

Linq-to-SQL and Performance.

HI, I am developing asp.net mvc site with linq-to-sql we are having 1000 cocurrent users and we are having performance problems. I have found that stackovewflow is also build on linq-to-sql? So can anybody know how they improved performance. Without line performance was good each page are loaded in 3 seconds but after migrating to lin...

How to bind dropdownlist data to complex class?

Hi I am using asp.net mvc 2.0(default binding model) and I have this problem. I have a strongly typed view that has a dropdownlist <%= Html.DropDownList("List", "-----")%> Now I have a model class like Public class Test { public List { get; set; } public string Selected {get; set;} public Test() { List ...

System.Web.HttpException in asp.net mvc 2 on images and javascript files

Hi I am getting the following errors reported by ELMAH on my asp.net mvc 2 site for javascript files, images etc. System.Web.HttpException: The remote host closed the connection I have done some research and it appears that the user/bot is clicking a link on the site before the page has fully loaded. Now this error never occurs o...

Managing Unique IDs in stateless (web) DB4O applications

I'm playing around with building a new web application using DB4O - piles of fun and some really interesting stuff learned. The one thing I'm struggling with is DB4O's current lack of support for stateless applications (i.e. web apps, mostly) and the need for automatically-generated IDs. There are a number of creative and interesting a...

Custom fine-grained claims based authorization system in ASP.NET MVC - wheres and hows

So, I'd like to implement my own custom authorization system in MVC2. If I'd have to create a global class, where do I instantiate it? Can HttpContext be extended with my own additions and where do I do that? Should I use Authorization filters for rights validation or ActionFilters or do it within an action? Can ActionFilter pass any da...

ASP.NET MVC - how to modify requested URLs?

The baidu spider seems to be adding ¤ to end of some crawled urls (it seems that it happens with urls containing single unicode character as the last character) The baidu-requested url looks like this: site.com/abc/ä¤ while site.com/abc/ä is the valid url and as linked from many places on my site. The internal problem is that a diff...

View artifacts leaking into the model of MVC

In an ASP.NET MVC application (which has very little chance of having its view technology ported to something non-HTML, but whose functional requirements evolve weekly,) how much HTML should ideally be allowed to be directly represented in the Model? I might come across as a design bigot for this, but I regard it as bad practice to allo...

Get selected value of dropdownlist in asp.net MVC

how can i get select value of dropdownlist and here is my code which is working fine. var list = new[] { new Person { Id = 1, Name = "Name1" }, new Person { Id = 2, Name = "Name2" }, new Person { Id = 3, Name = "Name3" } }; var selectList = new SelectList(list, "Id", "Name", 2); ViewData["People"] = selectList; <...

checkboxes jquery

<% foreach (var i in (IEnumerable<MvcApplication1.Models.Group>)ViewData["Group"]) { %> <input type="checkbox" name="Inhoud" value="<%= i.int_GroupId %>" /> <%= i.vcr_GroupName %><br /><br />(Checkboxes here) <% foreach (var ik in (IEnumerable<MvcApplication1.Models.Feature>)ViewData["Feature"]) { %> ...

String Parameter in url

Hy Guys, I have to pass in a method action a string parameter, because I want to implement a tags' search in my site with asp.net MVC but everytime in action it is passed a null value. I post some code! I try to create a personal route. routes.MapRoute( "TagsRoute", "Tags/PostList/{tag}", new {tag...

CMS (Web Application OR Windows Application)

I am a little bit puzzled about something. I am creating a ASP.NET MVC eCommerce application and currently I have written all the back end in ASP.NET MVC. I was thinking if its better to write all the management in WPF instead of HTML, as its probably even less prone to be exploited by hackers. I am a Windows user so I am not really bo...