Subscribe to Windows IT Pro

 

Get Newsletters

  • Get the Latest News
  • Product Updates
  • Helpful Tricks
  • Productivity Tips

Subscribe Now!

February 19, 2002 12:00 AM

Application Security with ASP.NET

SQL Server Pro
InstantDoc ID #24213
Rating: (3)
ASP.NET lets you deliver secure solutions quickly

Security on the Web can be difficult. The difficulty, however, isn't in conceiving a security model for your application but in implementing and managing it. You typically have to rely on the type of security that the OS provides. Active Directory (AD), for example, offers (among other things) a highly scalable user data store that's integrated into Windows to let you apply security to folders on your Web sites. But utilizing your OS for security presumes that your application will fit into the security model these types of services provide. What you need is a simpler way of applying security that's tightly integrated with your application. Before Microsoft .NET, you were pretty much stuck with what the OS provided unless you wanted to build or buy a whole new security layer. But with ASP.NET, you have all the flexibility you need to deliver secure solutions quickly.

Before you rip out all your custom security on your existing Active Server Pages (ASP) pages and move to ASP.NET, you need to understand the type of security that ASP.NET offers. The beauty of ASP.NET's approach to security is that it's quite simple to implement. Let's take a project that I'm currently working on as an example. Like everyone else, my team is frantically learning about all the cool new features that come with .NET. So we started this .NET project without understanding the power of the security built into ASP.NET. Our application is highly role-driven, meaning that one person can have more than one role that controls the types of activities he or she can perform in the application. At the tail end of a crushing project, at 3:00 in the morning (really), when we knew we had to implement security, we were tempted to follow old ways of embedding code at the top of each page to check whether a person is logged on and whether he or she has the proper authorization to view each page. Fortunately, the coffee was brewing, and we soon got smart about ASP.NET security.

Within hours, our application was fully locked down based on the roles within the application, and we didn't have to modify any of our Web pages. In ASP.NET, you can control and apply security within web.config files in each directory. The web.config files control many facets of your site, including authorization. Place a web.config file within each directory that you want to secure to lock it down. In the web.config file, we identified which roles could view the applications running within each directory. Here is a snippet of a web.config file we're using on our site:

     <authorization>
          <deny users="?" roles="TO,ED,TC,SP,CS,SM,IN,AT"/>
        </authorization>

This XML snippet within the web.config file shows which roles can't view the contents of the folder in which this file resides. These roles are part of the Web application.

So now ASP.NET is available, you're free to secure your Web sites in the way that works best for your application and not just for the OS. Better, the security moves with your application—wherever you install the application, you can be sure that it's locked down.

Related Content:

ARTICLE TOOLS

Comments
  • Anonymous User
    8 years ago
    Nov 27, 2004

  • 8 years ago
    Jan 29, 2004

    This article is useless. It tells a nice story, but doesn't actually give any detail on how to do ANYTHING.

You must log on before posting a comment.

Are you a new visitor? Register Here

advertisement

advertisement

White Papers

Get your Windows 7 deployment off to the right start by implementing PC lockdown. A locked-down environment is easier and cheaper to support since users are less likely to make unnecessary changes to the core system configuration - read more here!

Essential Guides

Is your iSCSI "lossy"? The reality is that most off-the-shelf Ethernet hardware deployed for iSCSI can lose packets, resulting in slow performance or application downtime. Learn how to assess your current iSCSI infrastructure and engineer an advanced iSCSI SAN infrastructure.

Web Seminars

What's the best way to keep your network safe from malware? In this web seminar, security expert Greg Shields suggests an alternative method to the traditional blacklisting approach that is common with anti-virus and anti-malware solutions.

eLearning Series

We bring the experts direct to you to share their real-world perspective and expertise. During each event, three sessions stream in real time, so you can learn, ask questions, and get solutions.
Upcoming event: Getting the Most with Exchange 2010 with Paul Robichaux

Subscribe to Windows IT Pro!

Windows is a trademark of the Microsoft group of companies. Windows IT Pro is used by Penton Media Inc. under license from owner.