简体   繁体   English

使用单独的web.config在子文件夹中运行网站?

[英]Running a website in a sub-folder using a separate web.config?

我想知道是否有可能在子文件夹中运行aspx.net网站,如果它具有自己的带有表单auth的web.config并正在使用角色管理员?

I've done this for nested applications recently. 我最近为嵌套应用程序完成了此操作。 Its not too difficult. 它不太困难。

In addition to having access the same data store for credential and role data, you need to: 除了可以访问同一数据存储区的凭据和角色数据外,您还需要:

  • make sure the the machineKeys are the same for both web applications 确保两个Web应用程序的machineKeys相同
  • configure loginUrl's to resolve to the same absolute path 配置loginUrl以解析为相同的绝对路径
  • if you're using cookies you need to make sure that the domain is set to a value available to both web applications 如果您使用的是Cookie,则需要确保将域设置为两个Web应用程序都可以使用的值
  • also for cookies, if your web applications are nested at diferent levels in a domain make sure that the path attribute is set to "/" 同样对于Cookie,如果您的Web应用程序嵌套在域中的不同级别,请确保将path属性设置为“ /”

See this blog post for more detail on getting forms authentication working. 有关使表单身份验证正常工作的更多详细信息,请参见此博客文章

Another issue particular to nested applications is that by default your nested web.config will inherit settings from the parent app's web.config. 嵌套应用程序的另一个特殊问题是,默认情况下,嵌套的web.config将继承父应用程序的web.config的设置。 This means that you may need to strip out some items in the child config that are in the parent config, and remove items that are currently in the child app config but would already be present in the parent config. 这意味着您可能需要去除子配置中父配置中的某些项目,并删除当前在子应用程序配置中但已经存在于父配置中的项目。 See this for more detail. 为更多的细节。

仅当您将此子目录设置为与iis不同的asp.net应用程序时

I think there won't be any problems if you use Virtual Directory. 我认为使用虚拟目录不会有任何问题。 Look here for more info: 在这里查看更多信息:

http://msdn.microsoft.com/en-us/library/zwk103ab(v=vs.80).aspx http://msdn.microsoft.com/zh-CN/library/zwk103ab(v=vs.80).aspx

http://www.dotnetspider.com/tutorials/AspNet-Tutorial-86.aspx http://www.dotnetspider.com/tutorials/AspNet-Tutorial-86.aspx

Is this what you were looking for? 这是您要找的东西吗?

Authentication can only be set in config for all applications, or root folder of web application. 只能在config中为所有应用程序或Web应用程序的根文件夹设置身份验证。 Same for setting session. 设置会话相同。 You can use sub folder. 您可以使用子文件夹。 But it has to be its own application , so basically it doesn't make a ton of sense to have it as subfolder of another application. 但是它必须是自己的应用程序,因此,基本上,将它作为另一个应用程序的子文件夹并没有多大意义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM