<!-- mobian-agent-page publisher="dailydev" canonical="https://daily.dev/posts/session-recording-mqjl5rcuk" -->

---
title: Session Recording | daily.dev
description: A submitted ASP.NET WebForms snippet shows a cascade of bad practices in code meant to delete an album owned by a user. It builds a SQL query by concatenating...
canonical: https://daily.dev/posts/session-recording-mqjl5rcuk
twitter:card: summary_large_image
twitter:site: @dailydotdev
og:type: website
og:site_name: daily.dev
og:title: Session Recording | daily.dev
og:description: A submitted ASP.NET WebForms snippet shows a cascade of bad practices in code meant to delete an album owned by a user. It builds a SQL query by concatenating...
og:url: https://daily.dev/posts/session-recording-mqjl5rcuk
og:image: https://api.daily.dev/og/posts/MQJL5rCUK.png
og:image:alt: Session Recording
og:image:width: 1200
og:image:height: 630
og:locale: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Session Recording

**[The Daily WTF](https://daily.dev/sources/thedailywtf)** · 3 min read · 0 upvotes · 0 comments

## Summary

A submitted ASP.NET WebForms snippet shows a cascade of bad practices in code meant to delete an album owned by a user. It builds a SQL query by concatenating values directly into the string, creating a SQL injection vulnerability. The album ID is pulled from a Label control via FindControl instead of a hidden field, the SQL string is stored as a class member variable instead of local, and session variables are overused, even as loop counters like 'Session("myloop") < 5'. The redirect URL also leaks a Hungarian-notation 'frm' prefix to users.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://thedailywtf.com/articles/session-recording>

## Questions this post answers

### why is concatenating session variables into a SQL string in ASP.NET VB.NET code dangerous

Building a SQL query by directly concatenating session values like Session("Albumid") and Session("Uid") into a DELETE statement creates a SQL injection vulnerability, since no parameterization or escaping is applied before the query reaches the database via objDB.ExecQry.

_Teams hardening legacy ASP.NET code can find similar real-world anti-patterns and fixes on daily.dev._

### is it bad practice to store form input values in an ASP.NET Label control

Yes, storing user input in a Label control and retrieving it with FindControl then casting to Label is a hacky pattern, since labels aren't meant to hold editable input. A hidden field is the more typical and appropriate way to store such values while presenting a different UI element to the user.

_Developers auditing old WebForms UI patterns can track these legacy quirks via daily.dev._

## Similar posts on daily.dev

- [Classic WTF: One-and-a-Half-Tiered Application Design](https://daily.dev/posts/classic-wtf-one-and-a-half-tiered-application-design-u5pu5ycfn) · The Daily WTF · 1 upvotes · 0 comments
- [Your Logout Button Is Lying: ASP.NET Session Security Done Right — Daily DevOps & .NET](https://daily.dev/posts/your-logout-button-is-lying-asp-net-session-security-done-right-daily-devops-net-swu9n2jai) · We Are .NET · 1 upvotes · 0 comments
- [Lab 1\#: Basic clickjacking with CSRF token protection \| Clickjacking Lab](https://daily.dev/posts/lab-1-basic-clickjacking-with-csrf-token-protection-clickjacking-lab-sdntbvotf) · InfoSec Write-ups · 0 upvotes · 0 comments
- [Extremely One Line](https://daily.dev/posts/extremely-one-line-oirzjyhit) · The Daily WTF · 9 upvotes · 2 comments

---

Tags: [#sql](https://daily.dev/tags/sql), [#code-review](https://daily.dev/tags/code-review)

[View this post on daily.dev](https://daily.dev/posts/session-recording-mqjl5rcuk)

```json
{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://daily.dev/#organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180},"sameAs":["https://twitter.com/dailydotdev","https://github.com/dailydotdev","https://www.linkedin.com/company/daily-dev-ltd"]},{"@type":"WebSite","@id":"https://daily.dev/#website","url":"https://daily.dev","name":"daily.dev","publisher":{"@id":"https://daily.dev/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://daily.dev/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]}
{"@context":"https://schema.org","@type":"TechArticle","headline":"Session Recording","url":"https://daily.dev/posts/session-recording-mqjl5rcuk","mainEntityOfPage":{"@type":"WebPage","@id":"https://daily.dev/posts/session-recording-mqjl5rcuk"},"datePublished":"2026-10-28T11:26:09.196Z","dateModified":"2026-10-28T15:00:44.937Z","description":"A submitted ASP.NET WebForms snippet shows a cascade of bad practices in code meant to delete an album owned by a user. It builds a SQL query by concatenating...","image":"https://media.daily.dev/image/upload/s--OHB84bZF--/f_auto/v1722860399/public/Placeholder%2010","thumbnailUrl":"https://media.daily.dev/image/upload/s--OHB84bZF--/f_auto/v1722860399/public/Placeholder%2010","isAccessibleForFree":true,"articleSection":"The Daily WTF","inLanguage":"en","publisher":{"@type":"Organization","name":"daily.dev","url":"https://daily.dev","logo":{"@type":"ImageObject","url":"https://daily.dev/apple-touch-icon.png","width":180,"height":180}},"author":{"@type":"Organization","name":"The Daily WTF","logo":"https://media.daily.dev/image/upload/t_logo,f_auto/v1/logos/d21a6aa61a7244d893a3b3284df8e2ef","url":"https://daily.dev/sources/thedailywtf"},"commentCount":0,"discussionUrl":"https://daily.dev/posts/session-recording-mqjl5rcuk","interactionStatistic":[{"@type":"InteractionCounter","interactionType":{"@type":"LikeAction"},"userInteractionCount":0},{"@type":"InteractionCounter","interactionType":{"@type":"CommentAction"},"userInteractionCount":0}],"keywords":"sql,code-review","timeRequired":"PT3M"}
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://daily.dev"},{"@type":"ListItem","position":2,"name":"The Daily WTF","item":"https://daily.dev/sources/thedailywtf"},{"@type":"ListItem","position":3,"name":"Session Recording"}]}
{"@context":"https://schema.org","@type":"FAQPage","@id":"https://daily.dev/posts/session-recording-mqjl5rcuk#faq","mainEntity":[{"@type":"Question","name":"why is concatenating session variables into a SQL string in ASP.NET VB.NET code dangerous","acceptedAnswer":{"@type":"Answer","text":"Building a SQL query by directly concatenating session values like Session(\"Albumid\") and Session(\"Uid\") into a DELETE statement creates a SQL injection vulnerability, since no parameterization or escaping is applied before the query reaches the database via objDB.ExecQry. Teams hardening legacy ASP.NET code can find similar real-world anti-patterns and fixes on daily.dev."}},{"@type":"Question","name":"is it bad practice to store form input values in an ASP.NET Label control","acceptedAnswer":{"@type":"Answer","text":"Yes, storing user input in a Label control and retrieving it with FindControl then casting to Label is a hacky pattern, since labels aren't meant to hold editable input. A hidden field is the more typical and appropriate way to store such values while presenting a different UI element to the user. Developers auditing old WebForms UI patterns can track these legacy quirks via daily.dev."}}]}
```

