Integrating ASP.NET C# website as subsite to a VB website
I have a ASP.NET 2.0 website created in C# that acts as a completely independent site and I am looking to integrate this into an existing ASP.NET 2.0 website created in VB.NET. Unfortunately I just don't know much about the server management side of ASP.NET yet so too much I'm unaware of when it comes to IIS configuration etc. Does anyone have any advice as to how I can go about integrating this? Basically I want to host it in a subdirectory from root so when you hit example.com/myindependantsite/ it will pull up my C# site.
One possible solution I came across mentioned just drop开发者_C百科ping the project folder into the root directory and setting up that directory as an application virtual directory in IIS? A few other random questions were small things like would my application relative links (~/for-example.aspx) stay relative to my root subdirectory if it's made into an application virtual directory? Just trying to get this running on their site but like I said it's completely independent so want to preserve my websites environment. Thanks everyone!!
First off, the language doesn't make any difference- they are both .NET, and can live side-by side easily. Setting it up as a virtual directory may work, depending on assumptions made when developing the C# site. Relative links will re-root to the virtual directory, assuming that you make it an application in IIS.
The problem you're going to run into by having one site as a sub-application of another site is that the web.config settings will cascade down from the root and they may not be compatible with each other.
Your links will be fine as long as they are made using the ~
notation because that will be relevant to the application root (which you will need to create to maintain the separation you're looking for).
Your biggest concern is truly going to be the cascade of the web.config and assembly entries there-in. If this creates a concern, you will have to separate them completely into different websites or into a different folder structure where neither is dependent on the other.
Other than that, if you can handle the configuration settings cascading down, then they will be able to coexist within that structure as separate applications as long as you give them independent application pools.
As Chris said, language doesn't matter.
If the sites are truly different things then it might make more sense to simply add a new third level domain name such as http://theotherstuff.mydomain.com which your c# site will live at. You could issue a redirect from http://www.mydomain.com/theotherstuff to push users to the other url.
Among other things this would help keep the web.config's completely separate. As it stands if your two sites work with different frameworks (2.0 vs 4.0) then you are going to run into other issues.
Can you define how you want to integrate the two sites?
As Chris said, since they are both .NET, the language really does not matter. As stated you could just create a folder in the root of the current site, add the code for your C# site to that, and create it as a virtual directory. It would be accessed like this: www.MyDomain.com/VirtualFolderName it would act as its own independent site.
As far as relative links, if I am remembering correctly they should evaluate from the virtual folder domain, so ~/example.aspx in your virtual folder should point to www.MyDomain.com/VirtualFolderName/example.aspx.
Hope that helps.
精彩评论