Dynamic ViewModel in default.cshtml

Is it possible to use dynamic ViewModel in default.cshtml (as per /NoModelNoController)?

I can use them in the main default.cshtml in the root of the site but if I use them in one of the other default.cshtml pages (e.g. similar to /stars/dead/joplin/default.cshtml) the value isn’t present.

I’ve used the following for test purposes:

<h1>TestVal - @Request.QueryString["Test"]</h1>

If I run RazorRockstars locally (self-hosted) with the above added to the root default.cshtml file and /joplin/default.cshtml. and hit: then I see the expected “TestVal - foo”.

However, if I hit then I only see "TestVal - " as the message and the URL is

If I add a breakpoint within the joplin/default.cshtml I get the message

The name ‘Request’ does not exist in the current scope

Is there something additional I need to do to get this behaviour in default.cshtml?

If you run RazorRockstars.WebHost instead of RazorRockstars.SelfHost it works as expected - you will get “TestVal - foo” on the page. As you rightly noticed SelfHost project redirects requests from /stars/dead/joplin/?test=foo to /stars/dead/joplin/ and this is why you could not get QueryString parameters. I can’t say right now how this redirect can be disabled in self host application (need further investigation), but currently you can switch to RazorRockstars.WebHost and test your application there.