1

I am looking for a method or a way to serve multiple html files to the site visitor the moment he enters the site.

Like:

Response.TransmitFile("index1.html");
Response.TransmitFile("index2.html");
Response.TransmitFile("index3.html");
Response.TransmitFile("index4.html");
Response.TransmitFile("index5.html");

I've went through AspNetCore documentation but haven't found anything sensible.

Any help appreciated.

ProgrammingLlama
  • 36,677
  • 7
  • 67
  • 86

1 Answers1

0

If I understand your goal, you are basically trying to have the site open multiple URLs when the user hits the site. In the questions, you specified "displayed in HTML", I'm assuming you mean actually rendered by the browser rather than just downloading the file.

In that case, your only real option I think is to use JavaScript on your View page to open new windows. Here's an example using the same URLs you specified above

<script type="text/javascript">
window.onload = function() {
   window.open("index1.html", "_blank");
   window.open("index2.html", "_blank");
   window.open("index3.html", "_blank");
   window.open("index4.html", "_blank");
   window.open("index5.html", "_blank");
}
</script>

Some notes & caveats with this approach:

  • This is not considered good behavior from a public website, and you might should reconsider if there's a better way to do what you want to do here. Abuse of this capability in the past is the reason for the next item as well.
  • Whether this works or not depends on whether the user allows pop-ups on your site. Virtually all modern browsers are going to block this by default, so you should include a graceful fallback for how to allow users to open the windows manually if they have pop-up blocking enabled.
  • This may have usability challenges for users who don't notice that a bunch of additional tabs have opened, specifically users who rely on screenreaders could have issues with this.
  • The "_blank" passed as the second parameter tells the browser explicitly to open in a new tab/window (based on the user's browser preferences). It's the default, but I like to specify it should the default change in the future.
OperatorOverload
  • 724
  • 4
  • 17