怎么做从www.samplewebsite.com/index.aspx到www.samplewebsite.com/abcd/index.aspx

问题描述:

我正在 asp.net 开发一个网站。我已经部署了这个网站,如



www.samplewebsite.com/的Index.aspx。



运行没有问题的网站

现在我的客户希望我将整个项目放在子文件夹视图中,如



www.samplewebsite.com/abcd/index.aspx



我要放index.aspx和index.aspx页面之前的abcd在主项目中。

我知道这可以在Ap.net MVC应用程序中轻松开发但我不知道怎么做在传统的aspx应用程序中。



我尝试过:



我我试图通过角度路径完成它。但是母版页没有正确呈现。它显示以下结果。



'/'应用程序中的服务器错误。

解析器错误

描述:解析服务此请求所需的资源时发生错误。请查看以下特定的解析错误详细信息并适当修改源文件。



解析器错误消息:无法加载类型'LiveAuction.SiteMaster'。



来源错误:





第1行:<%@ Master Language =C# AutoEventWireup =trueCodeBehind =Site.master.csInherits =LiveAuction.SiteMaster%>

第2行:

第3行:<! DOCTYPE html PUBLIC - // W3C // DTD XHTML 1.0 Strict // ENhttp://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">

I'm developing a website on asp.net .I've deployed the site like

www.samplewebsite.com/index.aspx.

The website running with no issue
Now my client wants me to put the whole project in sub folder view like

www.samplewebsite.com/abcd/index.aspx

I've to put the abcd before index.aspx and index.aspx page is in the main project.
I know this can be developed easily in Ap.net MVC application but I don't have any idea how to do that in traditional aspx application .

What I have tried:

I've tried to get it done by angular route .but the master page is not rendering properly .it shows the following result.

Server Error in '/' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type 'LiveAuction.SiteMaster'.

Source Error:


Line 1: <%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="LiveAuction.SiteMaster" %>
Line 2:
Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

您好,



您可以使用IIS的Url重写模块(7或以上)

这里是一个使用示例。



最佳

M。
Hi,

you can use the Url rewrite module of IIS (7 or above)
Here's an example of use.

Best
M.


将您的网站置于名为的虚拟目录中主站点下的abcd。如果您已正确编写了您的网站,它仍然可以正常工作。如果你没有那么它就不会:)你需要在找到问题时解决问题。常见问题是对URL进行硬编码路径,假设站点位于根目录中而不是使用正确的ResolveUrl函数等,或者在服务器端控件中使用〜来表示根目录。
Put your site in a Virtual Directory called "abcd" under the main site. If you have written your site correctly it will all still work. If you haven't then it won't :) and you'll need to fix problems as you find them. Common problems are hard-coding paths to urls, assuming the site is in the root rather than using the proper ResolveUrl functions etc, or using "~" in server-side controls to denote the root.