0

I need to access an html page "Pages/createCampaign.html" and/or "Pages/addCampaign.cshtml" and/or "wwwroot/html/insertCampaign.html" (I've created more as tests, but none seems to be working) from a click on a button inside "Pages/Index.cshtml".

Inside html.cshtml:

    <button type="button" class="create_but">
        <a href="../Pages/createCampaign.html">
            Create Campaign
        </a>

Follows the tree:

ASP.Net tree

Inside I've tried href="../Pages/createCampaign.html", href="../Pages/addCampaign.cshtml", href="../wwwroot/html/insertCampaign.html", and way more using tilde and more options. The only one I can access from Index.cshtml is the one in wwwroot/html folder BUT from there it can't find wwwroot/js and wwwroot/css whereas it can finds ~/css and ~/js from Pages.

What I need to do is to open the page to insert/create/add a Campaign from clicking that button in Index, but of course from there I need it to be linked to my css and js files.

How could I solve this situation?

Sara Briccoli
  • 141
  • 3
  • 11
  • See [Learn Razor Pages: The Anchor tag helper](https://www.learnrazorpages.com/razor-pages/tag-helpers/anchor-tag-helper) – Peter B Aug 30 '21 at 09:55

1 Answers1

1

I've read everything I found about static files and web root. Without specifying the file type from Index.cshtml I'm able to find addCampaign.cshtml like this:

<a href="~/addCampaign">
      Create Campaign
</a>

And seems like it can access js and css by <script src="~/js/site.js"></script> <link rel="stylesheet" type="text/css" href="~/css/site.css" media="screen"/>

Sara Briccoli
  • 141
  • 3
  • 11