Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

153
Views
<script> tags not added in response in asp.net core 5 for Web API

I want to handle Error StatusCode in asp.net core.

I wrote this in Startup>Configure

        app.Use(async (context, next) =>
        {
            await next();
            if (context.Response.StatusCode == 404)
            {
                var page = HttpFailedTemplates.NotFoundPage(context.Request.Path,
                        context.TraceIdentifier,
                        DateTime.Now.ToString(),
                        "نیل سافت",
                        "https://localhost:44313/");

                // in page I have -> <script src='https://localhost:44347/js/libraries/jquery.min.js'></script> in <body> tag

                context.Response.ContentType = "text/html";
                var buffer = Encoding.UTF8.GetBytes(page);
                using (var stream = context.Response.Body)
                {
                    await stream.WriteAsync(buffer, 0, buffer.Length);
                    await stream.FlushAsync();
                }
                await next();
            }
        });

But after return response I don't have Script tags

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I Added my Script tag in Head tag. Now it work.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!