Custom authorization with ELMAH and ASP.NET Identity Framework

If you’re using any of the most recent ASP.NET MVC 5 project templates with authentication and authorization built in, then you’re probably using the ASP.NET Identity Framework. With any ASP.NET project, it’s smart to add references to the ELMAH library just in case any unhandled exceptions occur. You can use both of these libraries together to restrict access to the remote ELMAH page with custom authorization.

First, install the Elmah.MVC package from NuGet. This should download the correct libraries and add the necessary lines to your web.config.

Substitute the “your_user_name” entry with your own username that you’ve setup in the ASP.NET Identity Framework backend. For example, the AspNetUsers table in SQL Server contains your usernames. It appears that ELMAH does get the authentication information from the current thread principal, which the ASP.NET Identity Framework will establish on your behalf upon login.… Continue reading

The required anti-forgery cookie “__RequestVerificationToken” is not present.

In your ASP.NET MVC adventures, you may come across the following error when loading a view.

The required anti-forgery cookie “__RequestVerificationToken” is not present.

After searching Google for awhile, you might become desperate with the many different solutions presented. Normally, the solution to this issue is related to the ValidateAntiForgeryToken attribute on actions. When accessing a GET action, you don’t need to use the anti-forgery token.

However, this is not the only solution. In my case, my web.config had this entry:

Checking the project settings in Visual Studio revealed that my project was not set to use SSL which caused a conflict. Either comment out the above line or set the project to always use SSL.… Continue reading

3 Types of Questions You Should Never Ask During an Interview

So your boss came to you and told you to conduct an interview for a new hire. Or maybe you’re actually the hiring manager. Guess what? These suggestions apply to everyone! Based on my experiences with many technical interviews, avoiding these 3 types of questions applies to anyone wanting to steer clear of legal issues and attract the best candidates with the most accurate predictions of success.

I won’t make any claims about being able to predict applicant performance in specific scenarios. This is mainly because studies have shown such predictions to be difficult to obtain regardless of the type of measure utilized during the interview process. While interviews can be a good predictor of how an applicant will apply knowledge in a general and broad scope, it’s extremely difficult to judge whether or not said applicant will succeed with a specific technology for a specific project that your company has in mind. It’s even more difficult to predict when you’re using bogus, irrelevant, and nonsensical questions as a measure.

My advice is to stick to standardized, measurable, specific, and proven questions that are directly relevant to the job position and company as a whole.

1. Personal Questions

I’ve already discussed this one in an article about learning to conduct interviews, but I want to repeat it because it’s an important one. I’ve personally experienced and heard stories about some interviewers who feel that it’s appropriate to ask the applicant about their personal life including hobbies, what they do in their spare time, family life, age, birthdays, religion, and more.… Continue reading

Teach your employees to conduct interviews

Conducting regular interviews is essential for any company that wants to find top talent. Not only is there a possibility of finding a random gem, but it guarantees that your business stays informed of the job market. How many people are looking? What are they looking for? Is my business situated to attract the right people? Such an important thing should probably be conducted by knowledgeable individuals, right? Hey, that’s just my opinion.

As someone who has experience being on the receiving end of the job interview onslaught, I want to take some time to give advice to those who conduct the interviews. This obviously comes from the perspective of the receiver, so I can’t help if my opinions are a little biased. Regardless, I think that there’s some valuable information on the other side of the table for those who are conducting the interviews. As a frequent interviewee, it it’s painfully obvious when an interviewer is not interested or isn’t trained well in conducting interviews.

Read the Resume, Please

I’ve noticed an alarming trend of some interviews being conducted without any references to or knowledge of the applicant’s resume. You know there’s some important stuff on there, right? Larger companies seem to be particularly guilty of this. It’s probably a symptom of receiving too many applicants to filter through at the beginning stages. I totally get that. I sympathize with companies that receive thousands of applications each week. But to ignore important background for applicant’s that pass various phases of the process seems silly.… Continue reading

If you’re a professional, communicate like one

So you’ve landed that job after reading my interviewing tips, right? When you start that job, what skills do you think will be necessary for success? Obviously, you’ll need the relevant knowledge, technical, and physical skills to get the job done. Unfortunately, one very important part of a successful employee is often neglected due to ignorance or indifference. Based on the title of this blog post, you may have guessed that the often lacking skill is “communication.” To clarify, the following advice can be applied to many types of jobs, but focuses on technology and office-oriented service positions.

It’s a shame that this skill is so poorly understood by many professional workers and academics, because it’s absolutely critical to conveying our ideas, knowledge, processes, and skills to colleagues and coworkers. Here are just some of the scenarios in which good and proper communication is key to success. These are just the things that I thought of in the last 45 seconds! The interested readers among you can probably come up with many more relevant examples.

  • Transferring domain specific knowledge to new workers or replacements
  • Training new workers on domain specific processes
  • Conveying company policies, rules, and regulations
  • Working within the immediate team to provide regular updates, feedback, and support
  • Communicating with remote coworkers, customers, and clients via video conference, teleconference, instant message, email, and phone

Transferring Knowledge and Training

There are often circumstances either within your control or beyond your control that may require you to transfer domain specific knowledge to a coworker, a new hire, or a replacement.… Continue reading

Tips for a successful software job interview process

Ah, the dreaded job interview. The call to set up an interview is always exciting, but the moment you realize that you have to perform well is nerve-wracking. Fortunately, I’ve been through the gauntlet of many interviews. I have some practical advice for you in this article, so read on! I recently wrote about some heinous experiences interviewing with some of the larger technology companies in the US. I can say, without a doubt, that I have some experience when it comes to being on the receiving end of the endless questions in an interview. Success in interviews comes from practice, study, and some luck. Not only are you being interviewed, but you should also be evaluating the company. How would you consider it a success if you end up in a company you hate?… Continue reading

In the last 8 months, I have interviewed with Google, Amazon, SpaceX, Blizzard, and StackExchange

Repeating the ridiculous technical interview process (including the onsite gauntlets) so frequently in such a short time span makes me feel like Bill Murray stuck in Groundhog Day. You know, the movie about the poor guy doomed to repeat the same day over and over until he becomes a better person. Am I stuck in a loop? Am I doing something wrong? Or are these job opportunities really just as “competitive” as the HR representatives claim in the copy and pasted emails that get sent out to the unlucky losers? I’m not convinced that the status quo for interviewing processes is sufficient.

I’ll admit it. I’m a bit cynical. It’s entirely possible that companies employing the standard technical interview process deserve the benefit of the doubt. Maybe they are bombarded with completely atrocious applicants who don’t even know how the most basic parts of a computer function. That’s fine. I understand. I get it! If I was receiving thousands of applications each week, I’m sure I would try to devise a firewall to keep most people out as well. But making a filter too finely grained causes one to miss out on some truly hidden gems.

For reference, every tech-related company seems to follow a fairly standard process of interviewing. It’s nearly formulaic.… Continue reading

Redirect your azurewebsites.net URL to your custom domain URL

If you’ve attached a custom domain to your Azure Websites setup, you probably want people and search engine crawlers to use the custom domain URL instead of the free azurewebsites.net URL. You can setup your application’s web.config to include the following.

Add the following to the system.webServer section of your web.config, but make sure you replace the “yourdomain” text with your own domain information.

Continue reading

Connect WordPress to Custom MySQL with Azure VM

The title is a bit of a mouthful, but I promise it’s not as crazy as it seems. If you’re anything like me, you became interested in cloud computing and stumbled upon Microsoft’s Azure platform. There are plenty of wizards built directly in to the Azure Dashboard which allow you to automatically create and setup websites, virtual machines, and databases without ever needing to perform extra configuration. However, there are some cases where you might want to setup a custom database for a specific purpose. WordPress is one great example which may require you to setup your own MySQL databases in a virtual machine. In fact, this guide assumes that you already have a WordPress Azure Website setup.… Continue reading

Using SQL to insert all rows from a select

Inserting all rows from a select statement is a fairly common operation. You may be transferring the contents of one table to another or performing a complex multi-joined select and moving those values to another temporary table. The basic statement goes something like this:

You can modify this for your specific purposes like so:

Continue reading