如何在一个解决方案下整合两个不同的网站项目? [英] How to integrate two different website projects under one solution?

查看:111
本文介绍了如何在一个解决方案下整合两个不同的网站项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用VS 2010,并试图集成我的两个不同的网站项目.我可以将它们都添加在一个解决方案下.默认情况下,启动项目是已经存在的项目.但是我无法从第一个项目重定向项目2的网页.我也找不到项目的名称空间.并且在添加参考时,不允许添加解决方案文件.在这方面的任何帮助都会有所帮助.

I am using VS 2010 and trying to integrate my two different website projects. I am able to add both of them under a single solution. By default the start up projects is the already present project. But I am not able to redirect the web pages of project 2 from the first project. I am also unable to find the namespaces of the project. And while adding reference it is not allowing the solution file to be added. Any help in this regard will be helpful.

我还附上了一个按扣.如您所见,在一个解决方案下,添加了两个项目.现在,从webSite1的home.aspx.cs页面,我想将其重定向到website2中的SRF-GeneralInfo.aspx页面.但是它无法重定向.

Edited: I have attached a snap as well. As you can see under a single solution two projects are added. Now from the home.aspx.cs page of webSite1, I wanna redirect it to the SRF-GeneralInfo.aspx page which is in website2. But it is unable to redirect.

注意:我仅在website1的现有解决方案中添加了website2.(没有参考或任何其他修改).

Note: I have only added website2 in the existing solution of website1. (No reference or anything else is modified).

推荐答案

是否具有要在两个网站项目之间共享的共享代码.将共享代码添加到类库(即DLL)项目中,并将类库引用到两个网站.

If you have a shared code that want to share between both website projects. Add the shared code to class library(i.e. DLL) project and reference the class library to both websites.

编辑:据我从问题编辑了解到,问题在于找到第二个网站的正确URL.您可以在web.config中将第二个网站URL添加为appSetting

As I understand from the question edit, the problem is in finding the right URL for the second website. You can add the second website URL as appSetting in web.config

<configuration>
    <appSettings>
        <add key="WebsiteURL" value="http://localhost:2030/" />
    </appSettings>
<configuration>

然后按照以下说明在您的页面中使用它

Then use it in your page as follow

  Response.Redirect(ConfigurationManager.AppSettings["WebsiteURL"] + "SRF-GeneralInfo.aspx");

这篇关于如何在一个解决方案下整合两个不同的网站项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆