How to integrate two different website projects under one solution?

橙三吉。 提交于 2021-02-11 04:29:22

问题


enter image description here

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.

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.

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


回答1:


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.

Edit: 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");



回答2:


Try HttpContext.Response.Redirect("/csweb/Default.aspx"). The symbol "~" current redirect will start in this application's home folder. By removing that you can redirect to some other location on your site.

more you can find here



来源:https://stackoverflow.com/questions/30364340/how-to-integrate-two-different-website-projects-under-one-solution

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!