asp.net-mvc-2

Difficulty Ignoring Route In Asp.Net Mvc

筅森魡賤 提交于 2019-12-08 04:37:44
问题 The following exception is being thrown after an IgnoreRoute method call: The controller for path '/anything.php' was not found or does not implement IController. However, I have the following method in my MvcApplication class: public static void RegisterRoutes(RouteCollection routes) { routes.RouteExistingFiles = false; routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.IgnoreRoute("{*php}", new { php = @"(/?.*/)*\.php$" }); // Some calls to routes.MapRoute occur here. } I'm not really

Developing ASP.NET MVC using MonoDevelop on MAC

半城伤御伤魂 提交于 2019-12-08 04:34:08
问题 I am developing a web app using ASP.NET MVC 2.0 in MonoDevelop. I have latest Mono 2.10 and MonoDevelop 2.4.2 and I am running them on Mac. According to mono’s release notes, it should support ASP.NET MVC 2.0. However, I found MonoDevelop’s project templates still only support ASP.NET MVC 1.0. So I had to create MVC project from MonoDevelop and remove system.web.mvc 1.0.0.0 from reference and add system.web.mvc 2.0.0.0 back in. I can write and compile code OK and MonoDevelop does provide

Should jQueryUI apply styles automatically

寵の児 提交于 2019-12-08 04:30:21
问题 I've created a theme and applied it to my ASP.NET MVC site. However, the elements on the page aren't picking up the styles automatically. If I do the following for a specific element they get applied appropriately: $("input[type=button]").button(); $("input[type=submit]").button(); Am I right in thinking I need to do this for all the different elements? Perhaps incorrectly, I assumed this would be done automatically by referencing the css and custom js files? Thanks 回答1: you can write :submit

Unreadable characters displaying in ASP.NET MVC

梦想与她 提交于 2019-12-08 04:05:37
问题 I am trying to build a store front. StoreViewModel public class StoreViewModel { public IEnumerable<GetStoreFrontItems_Result> StoreFrontItems { get; set; } } Index.aspx <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<StoreViewModel>" %> <asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server"> ..:: Gods Creation Taxidermy :: Store ::.. </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent

Custom IRouteHandler route screws up MVC link building

醉酒当歌 提交于 2019-12-08 03:49:08
问题 I have a custom routehandler in ASP.NET MVC2 to catch all url's at a prefixed path like this: routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.Add(new Route("@api/{*all}", new ApiHandler())); routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}", // URL with parameters new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults ); Routing works fine, but if i use Html.Actionlink or return ReturnToAction() from a controller, the uri

Is there an easy way to set up ASP.NET Membership tables in a custom Database?

匆匆过客 提交于 2019-12-08 03:15:40
问题 ASP.NET Membership is just great as there are a ton of functionality right there to be used, and we don't need to change nothing at all. We can even create our own Provider based on Membership database, and that give us infinite possibilities, like as I don't like the Question/Answer I just use an email that is sent with a reset link. But this is all done with SQLEXPRESS .mdf file and I wanted to use my own Database for this so I can use SQL Server Enterprise as we have in the Office and not

Spanish special characters like á ó while displaying shows jumbled or garbage value

梦想与她 提交于 2019-12-08 03:08:15
问题 I have a Spanish validation message which I'm trying to display using my JavaScript. And all the special characters like above gets changed into & #243;. And it is only happening when I'm using JavaScript, there are couple of more validation messages in Spanish which I'm displaying through server side and they are fine. errorString = "<%:Validation.xyz %>"; I'm trying to get from resource file. Can some one think of quick work around? 回答1: What you call garbage is actually but the HTML

ASP.Net MVC 2 - reusing Controller/View by indicating return Action and Controller in params

大城市里の小女人 提交于 2019-12-08 02:11:52
问题 Problem: In my application I have provide the user a selection screen for something in several places (that is, the same selection screen has to be used in several actions). Solution: I've come up with the following solution: pass the return action and controller to action which handles the entity selection . Example: Suppose that there are several places in the application where the user has to select an instance of SomeEntity , so I added the following action to that entity controller:

Redirect Authorization failure in mvc

僤鯓⒐⒋嵵緔 提交于 2019-12-08 01:48:44
问题 I have been doing this research for 2 days now, but i cant seem to find the answer. How to redirect user to a specific page This is what I have now: <authentication mode="Forms"> <forms loginUrl="~/Account/Member/LogOn" timeout="2880" /> </authentication> What i want to do is if user isn't authenticated redirect to this url: ~/Account/Member/LogOn" but if the user is already authenticated but not authorized, I want to redirect to this url: ~/Account/Member/Unauthorized" Is there anyway to do

How can host name be included in MVC2 route mapping?

守給你的承諾、 提交于 2019-12-08 01:29:27
I've got 3 domain names all pointed at the same MVC2 application. What I've got now is the homecontroller acting as a traffic cop and redirecting to controllers and views for the specific host name. But I don't like the URI result this causes... ex: www.webhost1.com/webhost1/imagegallery www.webhost2.com/webhost2/imagegallery I'd prefer to have: www.webhost1.com/imagegallery Is there a way to define the routes in global.asax that would include the host name in the routing evaluation so that the URI looks less redundant? Aha!, it took a bit of fiddling (and a peak in and old book) but I think I