Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      Designing For TV: The Evergreen Pattern That Shapes TV Experiences

      August 27, 2025

      Amplitude launches new self-service capabilities for marketing initiatives

      August 27, 2025

      Microsoft packs Visual Studio August update with smarter AI features

      August 27, 2025

      Optimizing PWAs For Different Display Modes

      August 26, 2025

      Why this $25 ratchet tool beats any multitool or Swiss Army Knife I’ve ever tested

      August 28, 2025

      One of my favorite sports watches from 2024 just got upgrades in all the right places

      August 28, 2025

      Google’s AI Mode is getting more links for you not to click on

      August 28, 2025

      I still prefer Apple Watch over Oura Ring for 3 key reasons – but there is one big drawback

      August 28, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      Heartbeat Collection Method in Laravel 12.26; Wayfinder Now in React and Vue Starter Kits

      August 28, 2025
      Recent

      Heartbeat Collection Method in Laravel 12.26; Wayfinder Now in React and Vue Starter Kits

      August 28, 2025

      spatie/laravel-rdap

      August 28, 2025

      mvanduijker/laravel-mercure-broadcaster

      August 28, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Geekom’s A9 Max mini PC is so good that I want to turn off my desktop gaming rig — and it’s not bad at AI, either

      August 28, 2025
      Recent

      Geekom’s A9 Max mini PC is so good that I want to turn off my desktop gaming rig — and it’s not bad at AI, either

      August 28, 2025

      ‘There Are No Ghosts At The Grand’ looks glorious — I’m more excited than ever for this upcoming Xbox Game Pass release

      August 28, 2025

      Epic Games CEO Tim Sweeney says Unreal Engine 5’s performance problems aren’t about the engine — they’re about when developers choose to optimize

      August 28, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»News & Updates»CodeSOD: The HTML Print Value

    CodeSOD: The HTML Print Value

    August 27, 2025

    Matt was handed a pile of VB .Net code, and told, “This is yours now. I’m sorry.”

    As often happens, previous company leadership said, “Why should I pay top dollar for experienced software engineers when I can hire three kids out of college for the same price?” The experiment ended poorly, and the result was a pile of bad VB code, which Matt now owned.

    Here’s a little taste:

    // SET IN SESSION AND REDIRECT TO PRINT PAGE
    Session["PrintValue"] = GenerateHTMLOfItem();
    Response.Redirect("PrintItem.aspx", true);
    

    The function name here is accurate. GenerateHTMLOfItem takes an item ID, generates the HTML output we want to use to render the item, and stores it in a session variable. It then forces the browser to redirect to a different page, where that HTML can then be output.

    You may note, of course, that GenerateHTMLOfItem doesn’t actually take parameters. That’s because the item ID got stored in the session variable elsewhere.

    Of course, it’s the redirect that gets all the attention here. This is a client side redirect, so we generate all the HTML, shove it into a session object, and then send a message to the web browser: “Go look over here”. The browser sends a fresh HTTP request for the new page, at which point we render it for them.

    The Microsoft documentation also has this to add about the use of Response.Redirect(String, Boolean), as well:

    Calling Redirect(String) is equivalent to calling Redirect(String, Boolean) with the second parameter set to true.
    Redirect calls End which throws a ThreadAbortException exception upon completion. This exception has a detrimental effect on Web application performance. Therefore, we recommend that instead of this overload you use the HttpResponse.Redirect(String, Boolean) overload and pass false for the endResponse parameter, and then call the CompleteRequest method. For more information, see the End method.

    I love it when I see the developers do a bonus wrong.

    Matt had enough fires to put out that fixing this particular disaster wasn’t highest on his priority list. For the time being, he could only add this comment:

    // SET IN SESSION AND REDIRECT TO PRINT PAGE
    // FOR THE LOVE OF GOD, WHY?!?
    Session["PrintValue"] = GenerateHTMLOfItem();
    Response.Redirect("PrintItem.aspx", true);
    

    [Advertisement]
    Keep all your packages and Docker containers in one place, scan for vulnerabilities, and control who can access different feeds. ProGet installs in minutes and has a powerful free version with a lot of great features that you can upgrade when ready.Learn more.

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous ArticlePassword Strength Estimator Validation in Laravel
    Next Article LintHTML – HTML5 linter and validator

    Related Posts

    News & Updates

    Why this $25 ratchet tool beats any multitool or Swiss Army Knife I’ve ever tested

    August 28, 2025
    News & Updates

    One of my favorite sports watches from 2024 just got upgrades in all the right places

    August 28, 2025
    Leave A Reply Cancel Reply

    For security, use of Google's reCAPTCHA service is required which is subject to the Google Privacy Policy and Terms of Use.

    Continue Reading

    CVE-2025-4063 – Code-projects Student Information Management System Buffer Overflow

    Common Vulnerabilities and Exposures (CVEs)

    CVE-2013-10050 – D-Link Router OS Command Injection Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Dutch Espionage Law Update 2025: Cyber Offenses Now Punishable by Up to 12 Years

    Development

    CodeSOD: Integral to a Database Read

    News & Updates

    Highlights

    SonicWall Patches 3 Flaws in SMA 100 Devices Allowing Attackers to Run Code as Root

    May 19, 2025

    SonicWall has released patches to address three security flaws affecting SMA 100 Secure Mobile Access…

    The best smartwatch and fitness tracker deals to shop now

    August 1, 2025

    CVE-2025-48138 – BERTHA AI Missing Authorization Vulnerability

    May 16, 2025

    WhatsApp will throw out “increased performance and reliability” by downgrading its Windows app — here’s what you’ll lose (and gain)

    July 22, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.