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

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube