0

I'm looking at reorganizing a large web site project into a class library project and a few smaller website projects, under one solution.

Supposing this structure:

Solution
  ClassLibProject
     Classes
  WebSiteProject01
    App_Pages
      Page01.aspx
  WebSiteProject02
    App_Pages
      Page02.aspx

If Page01 were in the same project as Page02, I would expect to call Page02 from Page01 using this

Response.Redirect("~/App_Pages/Page02.aspx")

How would I code the equivalent call from Page01 to Page02 if the pages are in separate projects?

wayfarer
  • 750
  • 2
  • 13
  • 32
  • Are you sure you can use the `~` for redirecting? – Uwe Keim Mar 10 '15 at 19:18
  • 2
    @UweKeim Yes, the framework will automatically convert it. – mason Mar 10 '15 at 19:19
  • 2
    If the pages are so tightly coupled that you need to redirect them to each other, why put them in different projects? That means you'll have to host them on different sites and handle converting the URL's for the other application. Ex: `string Web02Base = "http://example.com/Web02/"; Response.Redirect(Web02Base + "Page02.aspx");` – mason Mar 10 '15 at 19:23
  • I strongly suggest you use Web Application projects instead of web site "projects". You'll find that much more sane. See "[ASP.NET Web Site or ASP.NET Web Application?](http://stackoverflow.com/questions/398037/asp-net-web-site-or-asp-net-web-application)" – John Saunders Mar 10 '15 at 20:27
  • @mason, if that's correct, and I'm assuming that it is (because it makes sense; I can't see how it would work otherwise), then my proposed approach to re-organizing the code is a bust. Unless someone has a counter, I'll look for another way. – wayfarer Mar 10 '15 at 22:58
  • @wayfarer Why were you putting them in separate projects anyways if they're dependent on each other? Seems like just putting them in the same project, perhaps in separate subfolders, might be a lot easier. – mason Mar 10 '15 at 22:59
  • @JohnSaunders: thanks for input. I'm no longer a professional coder, and the learning curve from web site to web application has always stumped me. However, time for another look... – wayfarer Mar 10 '15 at 23:00
  • @mason: mostly to cut down the build times. By using "exclude from project" selectively, I can reduce build times from 20 seconds to 9 seconds. That 11 seconds makes a lot of difference in terms of my attention span. Then there's "edit and continue" if I migrate to web applications...but this isn't going to get past proof of concept, and I'm close to finishing...100K lines of code (including JS/JQ)...choices... – wayfarer Mar 10 '15 at 23:05

0 Answers0