问题
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