asp.net-mvc

Localizing Error Messages In ASP.NET MVC 2 (Default Validation Attributes)

Hey all ,,, i'm working on a multi language website and i want to localize the validation error messages for most of the ValidationAttribute such as [Requried] I know it can be done as Phil Haack have shown in this article. [Required(ErrorMessageResourceType = typeof(Resources), ErrorMessageResourceName = "Required")] but i want t...

How to get ASP.NET MVC to match dot (".") character at the end in a route?

ASP.NET MVC treats dot character as a literal for routes for a long time. However it doesn't match the route if the dot is at the end of the given route part. Given the route {controller}/{action}/{id} MVC matches these: http://test/somecontroller/someaction/some.id http://test/somecontroller/someaction/....some.id But not these: h...

How do you manage ASP.NET MVC users, after deployment?

How do you manage(CRUD) users in aspnet_db after you deploy your site? Do you just create models for them after merging the aspnet_db database into your sites database? And then create admin views to edit and manage them? ...

ASP.NET MVC - Management

Hey there, I'm trying to make a site which have following: News, Products, About and Contact. The problem is that for example the Products - I have an Index view to list the products for the user, but what if I want to make a "control panel" where I should be able to edit the products(names, prices, quantity) - how should that be done wi...

Libraries for Social network integration features with ASP.Net MVC 2.0

I am developing a public website on ASP.Net MVC2.0 and I am looking for open source libraries for Social Network Integration that give me following functionality. User can share a page to their facebook, twitter, linkedin and other accounts Retrieving tweets from an account Facebook "like this" ...

Log4Net works on Dev machine, fails when deployed to shared host (using same db/connstring)

I have log4net configured and working fine on my local machine, however when I deploy to my host (godaddy) it fails silently. I am using the same database/config file on my dev machine, and on the host. My log4net reference is set to copy local, and the log4net.dll, .pdb, and .xml exist in the bin on the host. This is an asp.net mvc app....

C# attribute: how to know class name which has field marked with attribute

particularly when overriding Asp.net MVC ValidationAttribute, is it possible to know class name which has field marked with attribute ? (AttributeUsage is AttributeTargets.Property) public class UniqueAttribute: ValidationAttribute public override bool IsValid(object value) { // how to know which class has t...

problem with routing asp.net

Hi, I am fairly new to asp.net and I have a starting URL of http://localhost:61431/WebSuds/Suds/Welcome and routing code routes.MapRoute( "Default", // Route name "{controller}/{action}/{page}", // URL with parameters new { controller = "Suds", actio...

hosting powershell like cli in asp.net mvc to perform maintaince

I need CLI for our asp.net mvc application to perform maintenance tasks and some status tasks. I think powershell is designed to provide CLI. But i do not know anything about it other than name. How can i host powershell in asp.net mvc running in iis to provide CLI for custom tasks? ...

Bad Request Error 400 on IIS7 .NET 3.5

I am running into a bad request error 400 on IIS7. I have encoded special characters in the URL string. My URL's look something like this (doesn't like %26): http://www.myjobs.com/a/q-Barnes+%26+Noble This would be an easy fix if I were running on .NET 4.0, but I am on rackspace cloud and can only run on IIS7 .NET 3.5. This is what ...

EF default generated classes and JSON

Hi, I have List<Car> cars = from c in myContext.Cars .Include("Wheels") .Include("Wheels.Nuts") orderby c.CarID These are all EF default generated objects. I want to turn this into JSON string containting all cars, each with its wheels, and each wheel with with its nuts, just like I would get ...

ASP.NET MVC - Block all visitors to a specific controller except search bots (Googlebot, Yahoo Slurp, etc).

I'm trying to create a controller for my sitemap, but only allow search engines to view it. If you look at http://stackoverflow.com/robots.txt you'll see that their sitemap is http://stackoverflow.com/sitemap.xml. If you try to visit the sitemap, you'll be redirected to the 404 page. This meta question confirms this behavior (answered...

asp.net mvc c# image upload page crashing

i am uploading an image ,when uploading image of a very large size the application crashes . i am checking the image size as well . but uploading image of a very large size bypass everything and crashes the application. What do u people suggest? what is the best practise? ...

Asp.Net MVC Post Controller Not being hit

I've got an Asp.Net mvc web app that has a controller action to handle a post with an int as a parameter. I've set a breakpoint in the action and it is never getting hit. Here is the controller action setup: [AcceptVerbs(HttpVerbs.Post)] public ActionResult AddTestNumber(int number) { And here is the jquery that calls th...

Querying with LINQ basic question

I actually have two questions today, but they are both small :-) 1) Where is a good resource for learning linq/sql selections in C#? 2) Say I have a table called Model, with properties Name, Color, Shape. How do I do a query to select only the rows which DONT have null values in any column. I've tried: var d = database.Portfolio.Sele...

ASP.net MVC custom route

hi,guy, i have a page in my asp.net mvc website. the Route configuration: public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Default", // Route name "{controller}/{action}/{index}", // URL with parameters ...

Debugging code in a view (asp.net mvc2)

Hello, How do I debug code in the View in asp.net mvc2 application? Edit after progress last night: Ok so now I have the following: in Shared\EditorTemplates\Equipment.ascx : <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<DAT.Models.Item>" %> <% using (Html.BeginForm()) {%> <%: Html.ValidationSummary...

How to get RouteData by URL?

I need to get RoutData by given URL string in ASP.NET MVC application. I've found the way that I need to mock HttpContextBase based on my URL string and then pass it to RouteTable.Routes.GetRouteData() method in Route Parsing (Uri to Route) thread. How to mock HttpContextBase to retrieve RouteData by URL string using RouteTable.Routes....

ASP.NET MVC - Multiplie views with same name?

Hey again, this question is mostly related to my previous question. I'm having an Edit view for my Product site to list the products with edit/delete link attached.. But how can I do: /products/edit = show list with edit/delete links. /products/edit/{productId} = show edit model (textboxes etc) for the specific product. ...

Displaying images returned as ActionResult (byte array) causes IE6 to freeze

Hi. Microsoft MVC, C#, IIS, CSS question. I have a problem with the following scenario in IE6: I have a View that would display a variable number of images, each image returned from the controller side as a BinaryResult. These BinaryResult objects are then assigned to the src attribute of the img elements in the page. Example, if I ...