locked
how to open javascript files that contain a magazine and games in the wwwroot RRS feed

  • Question

  • User-605499000 posted

    I am just changing over to asp.net core mvc from asp.net web.  I have a children's magazine and they go to a JavaScript file to open the mag and inside the JavaScript file are at least 30 pages and games to play.  I understand that I can't use default.aspx in wwwroot 

    questions

    do I make a controller for the magazines and then a model and then a view that will open the javascirpt files in the wwwroot.  That would be instead of a default aspx.

    Will the JavaScript files open in the root and  can I use javascirpt files to turn the pages and games 

    In the startup do I use fileupload to open the magazines in the wwwroot.

     Can I put jquery and html game files in the wwwroot

    I hope someone can answer these questions

    Thanks, Jen

    Tuesday, March 3, 2020 8:58 PM

Answers

  • User-474980206 posted

    You probably should look at razor pages rather than mvc. You structure the pages the same as in asp.net.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 4, 2020 1:35 AM
  • User-605499000 posted

    Thank you very much for your reponse.  I am looking into aspnet core and you are correct it might be the answer.

    Jen

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 4, 2020 3:02 PM
  • User-605499000 posted

    Hi again,

    Can't believe that I got you again. Very lucky for me and my project.

    Thank you for this answer and I will follow it. Last night I was looking into asp.net core razor but I have done so much with asp.net core mvc I plan on continuing on with it.

    With the code you gave me I think that I will be fine.

    Thanks again for everything

    Jen

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 4, 2020 3:05 PM

All replies

  • User-474980206 posted

    You probably should look at razor pages rather than mvc. You structure the pages the same as in asp.net.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 4, 2020 1:35 AM
  • User-854763662 posted

    Hi bumples18 ,

    It seems that you want to access the Static files in ASP.NET Core . Static files, such as HTML, CSS, images, and JavaScript, are assets an ASP.NET Core app serves directly to clients. Some configuration is required to enable serving of these files.

    1.Serve files inside of web root
    Invoke the UseStaticFiles method within Startup.Configure:

    public void Configure(IApplicationBuilder app)
    {
        app.UseStaticFiles();
    }

    2.Serve files outside of web root
    Consider a directory hierarchy in which the static files to be served reside outside of the web root:

    • wwwroot
        css
        images
        js
    • MyStaticFiles
        images
          banner1.svg

    A request can access the banner1.svg file by configuring the Static File Middleware as follows:

    public void Configure(IApplicationBuilder app)
    {
        app.UseStaticFiles(); // For the wwwroot folder
    
        app.UseStaticFiles(new StaticFileOptions
        {
            FileProvider = new PhysicalFileProvider(
                Path.Combine(Directory.GetCurrentDirectory(), "MyStaticFiles")),
            RequestPath = "/StaticFiles"
        });
    }

    For more details , you could refer to the official doc.

    Best Regards,

    Sherry

    Wednesday, March 4, 2020 2:20 AM
  • User-605499000 posted

    Thank you very much for your reponse.  I am looking into aspnet core and you are correct it might be the answer.

    Jen

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 4, 2020 3:02 PM
  • User-605499000 posted

    Hi again,

    Can't believe that I got you again. Very lucky for me and my project.

    Thank you for this answer and I will follow it. Last night I was looking into asp.net core razor but I have done so much with asp.net core mvc I plan on continuing on with it.

    With the code you gave me I think that I will be fine.

    Thanks again for everything

    Jen

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, March 4, 2020 3:05 PM