将 .NET 网站从一个域更改为另一个域时出现 404

发布于 2024-10-19 10:39:37 字数 268 浏览 1 评论 0原文

我有一个由其他人在 VS 2008 中创建的网站项目。它附加了一个 MSSQL 数据库。我已经让它在我们的开发域和本地运行良好。但是,当我尝试将文件复制到我想要用来托管站点的域时,除 default.aspx 之外的所有页面上都出现 404 错误。

页面的导航位于 masterpage.master.cs 中,并且从外观上看,存在 URL 重写。

我认为这可能是一个 web.config 问题。我确信这很简单。

任何帮助表示

赞赏

杰罗姆

I have a website project built by someone else created in VS 2008. It has a MSSQL database attached. I've got it running fine on our development domain and locally. But when I try to copy the files to the domain I want to use to host the site I get 404 errors on all of the pages apart form the default.aspx.

The nav for the pages is in the masterpage.master.cs and there is a URL rewrite by the look of it.

I thought it may be a web.config problem. I'm sure its something simple.

any help appreciated

cheers

Jerome

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

叶落知秋 2024-10-26 10:39:37

这是重写器代码

<rewrite url="^/home$" to="/App_Pages/default.aspx"></rewrite>
  <rewrite url="^/tour$" to="/App_Pages/tour.aspx"></rewrite>
  <rewrite url="^/blog(\?page=\d*)?$" to="/App_Pages/blog.aspx"></rewrite>
  <rewrite url="^/blog/(\d+)/(.+)$" to="/App_Pages/blogdetails.aspx?id=$1"></rewrite>
  <rewrite url="^/faqs$" to="/App_Pages/faqs.aspx"></rewrite>
  <rewrite url="^/sign-in$" to="/App_Pages/sign-in.aspx"></rewrite>
  <rewrite url="^/terms-and-conditions$" to="/App_Pages/terms.aspx"></rewrite>
  <rewrite url="^/privacy-policy$" to="/App_Pages/privacy-policy.aspx"></rewrite>      

  <!-- article -->

  <rewrite url="^/news/(.+)/(.+)$" to="/app_pages/news/details.aspx?id=$1"></rewrite>
    <rewrite url="^/news" to="/app_pages/news/archive.aspx"></rewrite>

</rewriter>

这是来自 master.cs 的代码

protected Dictionary PageData = new Dictionary
{

    {"/default.aspx", new PageInfo
        {
            colour = "blue",
            url = "/default.aspx?",      
            overrideUrl = "/",
            name= "home",

        }
    },        
    {"/tour", new PageInfo
        {
            colour = "orange",
            url = "/tour",
            name = "tour",
        }
    },
    {"/blog", new PageInfo
        {
            colour = "pink",
            url = "/blog",
            name = "blog",
        }
    },
    {"/faqs", new PageInfo
        {
            colour = "green",
            url = "/faqs",
            name = "faq's",
        }
    },
    {"/subscribe", new PageInfo
        {
            url = "http://www.thrivesolo.com/payment50.htm",
            name = "subscribe",
        }
    }
};

This is the rewiter code

<rewrite url="^/home$" to="/App_Pages/default.aspx"></rewrite>
  <rewrite url="^/tour$" to="/App_Pages/tour.aspx"></rewrite>
  <rewrite url="^/blog(\?page=\d*)?$" to="/App_Pages/blog.aspx"></rewrite>
  <rewrite url="^/blog/(\d+)/(.+)$" to="/App_Pages/blogdetails.aspx?id=$1"></rewrite>
  <rewrite url="^/faqs$" to="/App_Pages/faqs.aspx"></rewrite>
  <rewrite url="^/sign-in$" to="/App_Pages/sign-in.aspx"></rewrite>
  <rewrite url="^/terms-and-conditions$" to="/App_Pages/terms.aspx"></rewrite>
  <rewrite url="^/privacy-policy$" to="/App_Pages/privacy-policy.aspx"></rewrite>      

  <!-- article -->

  <rewrite url="^/news/(.+)/(.+)$" to="/app_pages/news/details.aspx?id=$1"></rewrite>
    <rewrite url="^/news" to="/app_pages/news/archive.aspx"></rewrite>

</rewriter>

This is code from master.cs

protected Dictionary PageData = new Dictionary
{

    {"/default.aspx", new PageInfo
        {
            colour = "blue",
            url = "/default.aspx?",      
            overrideUrl = "/",
            name= "home",

        }
    },        
    {"/tour", new PageInfo
        {
            colour = "orange",
            url = "/tour",
            name = "tour",
        }
    },
    {"/blog", new PageInfo
        {
            colour = "pink",
            url = "/blog",
            name = "blog",
        }
    },
    {"/faqs", new PageInfo
        {
            colour = "green",
            url = "/faqs",
            name = "faq's",
        }
    },
    {"/subscribe", new PageInfo
        {
            url = "http://www.thrivesolo.com/payment50.htm",
            name = "subscribe",
        }
    }
};
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文