c# - .NET - Dynamically get Web Root URL of another project -
i have 4 webforms projects in solution. want able url redirects page in webforms project.
currently have set url/port number in project web settings, set url in web config app setting, read , handle redirecting.
this real pain , makes deployments various environments obnoxious. there way dynamically handle via code?
to make above more complication may have projects mapped in iis such:
- www.mydomain.com/project1
- www.mydomain.com/test/project2
- www.mydomain.com/test/project3
but, shouldn't matter because can web root url server want redirect to:
httpcontext.current.request.applicationpath; i not sure if handling web config route best option or if can dynamically?
thanks assistance.
this pretty standard pattern here , believe or not, convention , configuration ways handle -- iis can lie, or iis might not know want , can give wrong answer. so, saying:
convention: got sort of standard relationship urls within app? regards dev, ci , qa typically frequent deployments? if so, setup default convention there app thinks right way. typically best or @ least easiest handle have different apps under iis applications off shared root.
configuration: production use might have url/ssl/other things @ play. make folders configurable.
trick mining stuff out of iis, besides fact doesnt give answer want, you've got alot of environmental stuff work through. presuming app can permissions query metabase, still need know idea of virtual site, etc. easier explicitly specify url figure out.
Comments
Post a Comment