c# - 如何访问没有页面扩展名.aspx的页面

标签 c# asp.net

我使用 c# asp.net 托管了一个网站

The page can be found here

如何访问没有扩展名.aspx的页面,如下所示:http://www.dailycashback.in/sample

当我们打开不带扩展名的链接时,它会重定向到 404 错误页面

最佳答案

添加到您的项目文件Global.asax。您只需要像这样添加路由。

protected void Application_Start(object sender, EventArgs e)
{
   RouteTable.Routes.MapPageRoute("sample", "sample", "~/sites/sample.aspx");
}

关于c# - 如何访问没有页面扩展名.aspx的页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39409455/

相关文章:

c# - .NET 不安全的字符串操作

c# - "Parameter is not valid"System.Drawing.Image.FromStream() 方法异常

asp.net - 对 ASP.NET 页面方法的 Ajax GET 请求?

c# - 带图像上传的 HTML 文本区域

c# - WinRT gridview 添加磁贴

C# 如何从 IntPtr 获取 Byte[]

c# - 使用 OleDbParameter 在 Access 中插入日期/时间值

c# - .Net MySql 用户定义变量作为输出参数

asp.net - 访问不同培养的资源文件

asp.net - 从 Windows Virtual PC XP 模式访问托管在 Windows 7 上的网站