DevDisasters

A Matter of Fax

That dinosaur of an office appliance -- the fax machine -- plays an unexpected role in Jason's Web site registration puzzle.

Not long ago, "Jason" (not real name) inherited ownership of Minitrode's old and buggy customer-facing Web site with its (marginally) functional VB.NET back end. This wouldn't be remarkable except that, years ago, it had been originally coded by the now highly-regarded technical director of the company. Apparently, it was an "honor" to receive ownership of the codebase.

Just in time for the ownership transfer, there were reports of sporadic issues with the new user registration process. As the final step in the registration process, new users of Minitrode's site should receive an e-mailed activation code -- a six-digit number -- and click the link in the e-mail to activate their account. However, sometimes the e-mails would not get sent, making the process quite the hot-button item.

At first, mostly owing to the fact that he was new, Jason had some difficulty locating the property on the account object that stored the activation code. However, speaking with the technical support team gave him some direction on where to search.

He learned that whenever a customer called in after not receiving their code, a rep would simply go into the CRM system, navigate to the company record, find the fax number and delete it. This would make the Web site think that the customer's account had been activated.

Armed with this tantalizing (if somewhat puzzling) clue, Jason delved into the code once more, but this time found something that at least made some sense:

_objCompany.Fax  = _strActivationCode
  

Instead of using an Activation code field, the Web site stored the activation code in the fax number field.

Now the registration process flow made sense -- upon activation, the back-end code would delete the fax number and then later, upon log-in, check if the fax number was empty to determine if the account had been activated yet.

"I don't know who decided to go with using the fax number field or when," explained one of the most senior CSRs in a follow-up meeting, "but really, who even has a fax machine nowadays?"

Jason nodded in acknowledgement; even his company didn't have any fax machines. In fact, he couldn't think of when he'd last used a fax machine.

Armed with a partial explanation, Jason went back to his cubicle, but he wasn't fully satisfied. There just had to be more to this story. Yes, the fax number was involved, but how? What if the activation number triggered some oddball bug that made the e-mail program go out to lunch?

Digging deeper, Jason learned that the Web site was referencing a custom DLL, named "Minitrode.Services," and was using the following to generate the random six-digit activation number:

'Create the activation code
_strActivationCode = Minitrode.Services.Data.Formatting.RandomNumber & 
Minitrode.Services.Data.Formatting.RandomNumber & 
Minitrode.Services.Data.Formatting.RandomNumber & 
Minitrode.Services.Data.Formatting.RandomNumber & 
Minitrode.Services.Data.Formatting.RandomNumber & 
Minitrode.Services.Data.Formatting.RandomNumber

"Hmm, that's curious. Why use a custom library for generating a "RandomNumber"?"Jason thought as he made the fateful decision to open up said custom DLL and check the code.

Protected Shared m_objRandom As New System.Random
Public Shared Function RandomNumber() As String
   	Dim _int As Integer
   	_int = CType(m_objRandom.NextDouble * 10, Integer)
   	Select Case _int
	   Case 1 To 9 : Return _int.ToString
	   Case Else : Return "9"
   	End Select
End Function

Knowing that that this code would probably be representative of the rest of the site made Jason feel ill, but it didn't solve the task at hand. Why were e-mails sometimes not sent out?

The reason for that, it turned out, had hardly anything to do with coding. Instead, it was more like a case of the right hand not knowing what the left one was doing.

As it turned out, during sign-up, new users could still (optionally) enter a fax number, and if they went so far as to include any non-numeric characters (hyphens or parentheses), it would break the notification code.

Jason shrugged and commented out loud, "I guess that some people still use their fax machines after all."

About the Author

Mark Bowytz is a contributor to the popular Web site The Daily WTF. He has more than a decade of IT experience and is currently a systems analyst for PPG Industries.

comments powered by Disqus

Featured

  • Mastering Blazor Authentication and Authorization

    At the Visual Studio Live! @ Microsoft HQ developer conference set for August, Rockford Lhotka will explain the ins and outs of authentication across Blazor Server, WebAssembly, and .NET MAUI Hybrid apps, and show how to use identity and claims to customize application behavior through fine-grained authorization.

  • Linear Support Vector Regression from Scratch Using C# with Evolutionary Training

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the linear support vector regression (linear SVR) technique, where the goal is to predict a single numeric value. A linear SVR model uses an unusual error/loss function and cannot be trained using standard simple techniques, and so evolutionary optimization training is used.

  • Low-Code Report Says AI Will Enhance, Not Replace DIY Dev Tools

    Along with replacing software developers and possibly killing humanity, advanced AI is seen by many as a death knell for the do-it-yourself, low-code/no-code tooling industry, but a new report belies that notion.

  • Vibe Coding with Latest Visual Studio Preview

    Microsoft's latest Visual Studio preview facilitates "vibe coding," where developers mainly use GitHub Copilot AI to do all the programming in accordance with spoken or typed instructions.

  • Steve Sanderson Previews AI App Dev: Small Models, Agents and a Blazor Voice Assistant

    Blazor creator Steve Sanderson presented a keynote at the recent NDC London 2025 conference where he previewed the future of .NET application development with smaller AI models and autonomous agents, along with showcasing a new Blazor voice assistant project demonstrating cutting-edge functionality.

Subscribe on YouTube