0

We have an ASP.NET MVC website that runs happily at eg. www.test.com.

We would like to shunt it to a subfolder on www.test.com/xyz. Anyone visiting the root should get nothing - we are quite happy if the root location 404s or is blank or just shows a holding page index.htm. Basically we want to crudely obfuscate the site's new xyz location.

We don't have access to IIS on the hosting so would like to do this all just by moving the files around (and perhaps editing web.config).

From research done here on similar questions it seems that location of web.config is crucial. Ours is the version built by Visual Studio when generating a new MVC application so 140+ lines of configuration which we don't normally mess with too much and haven't had to understand in depth.

What we have tried:

  • web.config in the subfolder only
  • web.config in the root only

Neither of these above attempts work. e.g. if the web.config is in the root only we get an error:

Could not load file or assembly 'Microsoft.AspNet.TelemetryCorrelation' or one of its dependencies. The system cannot find the file specified.

at www.test.com, and a 500 error at www.test.com/xyz

I sense we need to split web.config and have some of it in the root (the bare essentials?) and the rest in the subfolder, but I am far from sure of the syntax.

hawbsl
  • 15,313
  • 25
  • 73
  • 114
  • You may need to make the subfolder an app in IIS, which in your case you can't access. Also, this can help: https://stackoverflow.com/a/2049315/177416 – Alex Jan 22 '21 at 12:10
  • Could you please post your root's web.config content for analysis? It's quite hard right now to tell what may be going wrong without seeing it. Also, what's the message that IIS returns with the 500 error? Does this error appears when you move all your app's files into subfolder with same root's web.config? Or have you customized it when moving it into subfolder? Thanks in advance. – Jorge C.M Jan 28 '21 at 10:28
  • @JorgeC.M i am happy to post the web.config here but really it's 99% the vanilla autogenerated web.config that Visual Studio creates for you with a new project. i'd have to remove 1) connectionstring 2) PayPal stuff to post it here, and those are basically the only two things which are bespoke to our project – hawbsl Jan 28 '21 at 16:46
  • @JorgeC.M can't reproduce the 500 error today, but right now there's an error "Could not load file or assembly 'Microsoft.AspNet.TelemetryCorrelation' or one of its dependencies. The system cannot find the file specified." ... which isn't mysterious, since the web.config in the root is in the "wrong" folder to get at those references. ... that's with the web.config in the root and the rest of the project in the subfolder – hawbsl Jan 28 '21 at 16:47

0 Answers0