Search code examples
c#asp.netvisual-studio-2010visual-studioprojects-and-solutions

How to integrate two different website projects under one solution?


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).


Solution

  • 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");