我正在尝试学习MVC,并努力将数据从url传递到控制器。当我转到localhost:XXX/post/2时,我得到了一个404 not found错误:XXX/post/2- im在这里错误地签名了一些明显的东西。有什么想法吗?
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.Entity;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Conference.Models;
namespa
我正在尝试将一个ASP.NET MVC 4.x应用程序移植到ASP.NET Core2.2。WebApi工作得很好,但我仍然坚持在MVC视图上进行移植。我创造了一个完整的“最小可行”的复制来展示我的意思。Program.cs看起来如下所示:
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
namespace TestApp
{
public class Program
{
ASP.NET MVC路由在映射时具有名称:
routes.MapRoute(
"Debug", // Route name -- how can I use this later????
"debug/{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = string.Empty } );
有没有办法获得路由名称,例如上面例子中的"Debug“?我想在控制器的OnActionExecuting中
我使用Dev的空模板创建了一个C# web应用程序项目。当我运行该项目时,会得到一个错误,指示找不到资源。
复制步骤
在VS2013文件中->新建->项目模板->VisualC# ->Web->DevExpress v15.1 TemplateGallery
用C位置命名DXWebApplication1:\User\kirsten\Documents\
ASP.Net ASP.Net MVC Visual C#空Web应用程序
创建项目
构建并运行
错误信息是
Server Error in '/' Application.
The resou
在我的Asp.net MVC项目中设置默认路径有问题。我的global.asax没有Routes.MapRoute,它只有下面的代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Routing;
namespace razor
{
// Note: For instructions on enabling IIS6 or IIS7 cl