How to implement Windows authentication and authorization in ASP.NET

This step-by-step article describes how to implement Windows authentication and authorization in an ASP.NET application. To use the built in security of Windows and ASP.NET, implement Windows authentication and authorization on groups and users. To use Windows authentication, you must adjust settings in both Microsoft Internet Information Services (IIS) and the ASP.NET application Web.config file.

Authentication and authorization

Windows authentication and Windows authorization are two terms that are frequently interchanged. However, they do not have the same meaning. Windows authentication permits the recipient to determine the user's identity. Windows authorization determines the resources to which a user may gain access.

Configure Web application for Windows authentication

In the HTML view of WebForm1.aspx, replace the existing code with the following sample code:

<%=User.Identity.Name%>

Click Start, point to Programs, point to Administrative tools, and then click Internet Information Services.

The Internet Information Services MMC appears. Expand Computer, and then expand a Web site that uses Windows authentication.

Click the ASPNETWinAuth Web site application.

On the Action menu, click Properties.

In Properties, click the Directory Security tab.

Under Anonymous access and authentication control, click Edit.

In Authentication Methods, click to select Integrated Windows authentication. Click to clear all other check boxes.

Click OK.

In Properties, click OK. The ASPNETWinAuth Web application is now configured to accept valid user accounts.

Configure the ASP.NET application

After you configure the IIS Web site for Integrated Windows Authentication, you must configure the ASP.NET application to recognize authenticated users. To do this, you must change the Web.config file. In the Web.config file, locate the <authentication> tag, and then set the mode attribute to Windows, as in the following example:

<authentication mode="Windows" />

Test authentication

To test your Windows authentication setting, follow these steps:

In Microsoft Internet Explorer, view the WebForm1.aspx page. This page is located in the Http://Localhost folder. For example:

http://Localhost/ASPNETWinAuth/WebForm1.aspx

Because Integrated Windows Authentication uses the current Windows user information on the client computer for the authentication, it does not immediately prompt the user for a user name and password. However, if the authentication exchange cannot identify the user, a dialog box appears that prompts the user for a Windows user account user name and password.

Type a valid user name and password. When the page loads, your user name appears in the following format:

Domain Name\User Name

Restrict access

In ASP.NET, you set authorization to the application by adding settings in the Web.config file. You can specify which users or groups are permitted to have access to what resources as follows:To permit all users of an NT Group named Managers to have access to your resources, use the following code:

Note You can specify multiple roles or users by using a comma separated list. Verify that you use the correct case when you specify the configuration file element and the associated attribute values. This code is case sensitive.

Best Windows Server 2012 Hosting Recommendation

ASPHostPortal.com provides our customers with Plesk Panel, one of the most popular and stable control panels for Windows hosting, as free. You could also see the latest .NET framework, a crazy amount of functionality as well as Large disk space, bandwidth, MSSQL databases and more. All those give people the convenience to build up a powerful site in Windows server 2012. We offers Windows hosting starts from $5/month only. We also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable Windows server 2012 Hosting, we should be your best choice.

This article is for people to change their Windows 7 DNS settings. It will also override the DNS settings sent through DHCP so it is acceptable for most users of Windows 7. You will need admin rights in order to preform some of these steps.1. Choose two or more IP addresses from here, then open the Control Panel and click on Network and Sharing Center as seen below.

2. Click “Change Adapter Settings” in the left bar.

3. Right click on your network device and choose properties. In my case this was Local Area Connection, but it could also be a wireless adapter or named something else.

4. Choose the IP version you would like to set the DNS settings for and click “properties”. I will be choosing IPv4 for this guide, but the steps are basically identical for IPv6.

5. In the window that pops up, click “Advanced” in the bottom right of the windows

6. Click the “DNS” tab at the top.

7. Click Add and then type a Tier2 server IP in the box that pops up and click add again.You may repeat the add step as many times as you want to add more DNS servers. DNS servers added to the list are being tried consecutively after a short timeout when one or more of them are offline.8. Click OK until you are out of dialogue boxes!

Best Windows Server 2012 Hosting Recommendation

ASPHostPortal.com provides our customers with Plesk Panel, one of the most popular and stable control panels for Windows hosting, as free. You could also see the latest .NET framework, a crazy amount of functionality as well as Large disk space, bandwidth, MSSQL databases and more. All those give people the convenience to build up a powerful site in Windows server 2012. We offers Windows hosting starts from $5/month only. We also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable Windows server 2012 Hosting, we should be your best choice.

Demystifying the Windows Registry

The registry is a key component of the Windows operating system. It is so important, that without it, Windows would not even run. When a new piece of hardware or software is installed in Windows, it stores its configuration into the Registry. This allows Windows to retrieve that information at later dates such as when it is starting up. As Windows starts it will read the configuration in the registry and know what drivers need to be loaded, what settings to be applied, and what resources need to be allocated in order for this equipment to work. Because this information is stored in the Registry on your hard drive, Windows has this information available each time it boots up.

The registry, though, is not only for operating system settings. User preferences and application settings are stored in the Registry as well. When you change your desktop background or screen saver, these details are stored in the Registry. Now when you shutdown Windows and start it up again at a later date, your preferences are available and loaded automatically. Application settings such as what directory you would like to download files to or what your default font is in a word processor are stored here as well. As you can see the Registry contains information that is not only vital to the use of the operating system, but also essential in allowing you to customize Windows to your particular tastes.

Structure of the Registry

The Registry is a hierarchical structure similar to what you see when looking at a directory/file tree on your computer. You have a main key, or Hive, with Keys, Subkeys and then Values. Each of these are discussed below:Hives - Hives are the top most portions of the hierarchical data tree with each Hive containing a certain category of information. For example one Hive may contain the configuration that applies to the particular user logged on, while another Hive will contain information about the hardware installed in the computer. Depending on the version Windows that you are running there will be 5 or 6 different hives. Below we have outlined the 6 possible hives:

HKEY_CURRENT_USER (HKCU) - This Hive contains the preferences and configuration for the particular user who is currently logged in. If a different user is logged onto the same machine, then the information in this Hive would change corresponding to that particular user's configuration.

HKEY_LOCAL_MACHINE (HKLM) - This Hive contains the configuration for the actual computer. The information in this Hive remains the same regardless of the user currently logged on.

HKEY_CLASSES_ROOT (HKCR) - This Hive contains the information which pertains to the core user interface such as file associations and shortcuts.

HKEY_USERS (HKU) - This Hive contains the user information for all the users that have ever logged onto this computer.

HKEY_CURRENT_CONFIG (HKCC) - This Hive contains the information about current hardware configuration. This Hive is linked to the HKLM Hive.

HKEY_DYN_DATA (HKDD) -This Hive is found only on Windows 95/98/ME. It contains information about hardware Plug and Play. This Hive is linked to the HKLM Hive.

Keys - Keys are an organizational unit in the Registry. Keys are containers that can either contain values or further subkeys. Subkeys themselves, can contain further subkeys. Keys are similar to folders in that they can contain further subkeys or the file, or what we call values in the Registry.

Values - Values contain the actual data that is being stored in a Key or a Subkey. There are quite a few different types of values that can be stored in the Registry, but the most common that you will see are binary, strings, and DWORD values.When visualizing the Registry you should look at the Hives, Keys, and Subkeys as the path that you will need to navigate in order to reach the final stored information which is the Value.

An example Registry key can be seen below. This Registry key controls what your initial start page will be when using Internet Explorer.

When we break this Key down to its components we can see the following:

HKEY_CURRENT_USER is the Hive that this key is associated with.Software is a KeyMicrosoft - This is a SubkeyInternet Explorer - This is a SubkeyMain - This is a SubkeyStart Page - This is the Value that the actual data is stored in. For this particular Value, the data will be the start page that you want Internet Explorer to use.

Where the Registry is stored

The Registry itself is stored on your computer in certain files. Below we detail what files and their locations are used to store the Registry based upon the particular version of Windows.For Windows NT 4.0, Windows 2000, Windows XP, and Windows Server 2003, the Registry files are stored in the following directories:%SYSTEMROOT%\System32\Config%USERPROFILE%\ntuser.dat

The names for the registry files are:

Sam, Sam.log, Sam.savSecurity, Security.log, Security.savSoftware, Software.log, Software.savSystem, System.alt, System.log, System.savSystem, System.alt, System.log, System.sav, Ntuser.dat, Ntuser.dat.logDefault, Default.log, Default.savFor Windows 98, the registry files are named User.dat and System.dat and are stored in the C:\Windows directory.For Windows Millennium Edition, the registry files are named Classes.dat, User.dat, and System.dat and are stored in the C:\Windows directory.

How to edit the Registry

In order to modify values in the Registry you need to use a program called a Registry Editor. Windows comes with a program called regedit.exe or otherwise known as Registry Editor. To launch this program you should click on the Start button, then click on the Run option, and in the field type regedit.exe and press the OK button. This will launch the Registry Editor.When you open Registry Editor you will see two panes. The left pane is your navigation pane. By default it will list all the Hives with a + or - next to each one. You can click the + to expand the tree underneath that Hive revealing Keys and Subkeys. You would keep navigating the Subkeys until you reach the desired location and then click on it once to highlight it. Then you will see in the right pane a listing of the values associated with that key.In the screenshow below you will see an image of the Registry Editor where I have navigated to the key:

HKEY_CURRENT_USER\Control Panel\Colors

In Figure 1 above, the Hive that we are in is HKEY_CURRENT_USER. They Key is Control Panel and the Subkey is Colors. The right hand portion shows all the Values contained in the subkey Colors.To modify a Value, you would double-click on the value name and a screen similar to Figure 2 below would appear.

You then would type in the appropriate information into the Value data field and press the OK button.To delete values, instead of double-clicking on a value name you would right-click on the value and then select Delete. This method can also be used to delete keys or subkeys. To add a value you click on the Edit menu option and then select New and pick the appropriate type.It is also possible to export and import Registry values into your Registry. To export a particular Key or Subkey you would click once on the key you would like to export and then click on File and then Export. Then select a directory and filename to export the Registry key to. Likewise, you can also Import keys into the Registry by clicking on Import and then selecting the file that you had exported previously.

Backing up the Registry

Viruses, Spyware, and other Malware can cause corruption and damage to the Registry. With this in mind, it is important to backup your registry so that you know you have a clean copy stored safely on your hard drive in case of an emergency. Below we have outlined the steps to backup and restore your Registry under the various versions of Windows.

Backing Up the Windows 95 Registry

Reboot your computer and when you see "Starting Windows 95" press the F8 key. Then choose Safe Mode Command Prompt Only from the startup menu and press enter.

At the command prompt type the following lines, pressing ENTER on your keyboard after each line:

WARNING : This will restore the previous backup that you had made. If you had chosen an extension other than .bak when you had backed up the Registry previously, then substitute that extension above.

Restart your computer.

Backing Up the Windows 98/ME Registry

Click the Start button, then click Run.

Type scanregw in the field and press the OK button.

When the program has finished scanning the Registry for errors it will ask if you would like to back up the Registry.

Click the Yes prompt and the program will create the backup.

When it is completed, press the OK button.

Restoring the Windows 98/ME Registry

For Win98, reboot your computer and press and hold the CTRL button. Then choose Safe Mode Command Prompt Only from the startup menu and press enter. For Windows ME, start your computer with a startup disk and select Start Computer without CD-ROM Support.

You will now be at a command prompt. Type c:\windows\command\scanreg /restore and press enter on your keyboard. A screen will will appear with a list of the previous Registry backups sorted by date. Using the arrow keys, select the Registry backup you would like to restore and press enter. A known previously working Registry backup will have the word Started next to the date.

Scanreg will now restore the Registry and check it for errors. When it is done you will receive confirmation and you should now press enter to reboot your computer. If you had booted your computer with a floppy, please remove the floppy first before rebooting.

Backing Up the Windows XP/2000/2003 Registry

Click on Start, then All Programs, then Accessories, then System Tools, and then click on Backup. If you do not see the Backup utility you will need to install it using your XP or 2003 CD.

When the program launches, if you are not in the wizard, select the Backup Wizard Option.

When the Wizard opens press the Next button.

Select "Only back up the System State Data". Keep pressing next until you see Finish.

Press the Finish button to start the Registry backup.

When it is completed you will see a report of the backup. You can then press the Close button and then exit the program.

Restoring the Windows XP/2000/2003 Registry

Option 1:

Click on Start, then All Programs, then Accessories, then System Tools, and then click on Backup. If you do not see the Backup utility you will need to install it using your XP or 2003 CD.

When the program launches, if you are not in the wizard, select the Backup Wizard Option.

When the Wizard opens press the Next button.

This screen will list all the known backups that were done previously. Select the System State backup that you would like restored.

Press the next button and then the Finish button.

When it is completed you will see a report of the backup. You can then press the Close button and then exit the program.

Option 2 (Only for XP and 2003):

Insert your Windows CD into your computer and reboot.

When it prompts you to "Press Any Key to Boot from CD", press any key.

When the screen appears that gives you the options to Setup, Repair or Quit, press R on your keyboard to enter repair mode.

At the next screen select the installation of windows you would like to work on. For most people there will be only one option.

NOTE: If it prompts you to overwrite the existing files, select Y for yes.

When you are finished, type exit and press enter.

Remove your Windows CD and reboot.

Conclusion

Understanding and knowing how to backup the Registry is an important part of keeping your computer secure and running efficiently. It must be stressed that modifying any portion of the Registry should be done with the utmost care as incorrect usage of the Registry could make your computer inoperable.

Best Windows Server 2012 Hosting Recommendation

ASPHostPortal.com provides our customers with Plesk Panel, one of the most popular and stable control panels for Windows hosting, as free. You could also see the latest .NET framework, a crazy amount of functionality as well as Large disk space, bandwidth, MSSQL databases and more. All those give people the convenience to build up a powerful site in Windows server 2012. We offers Windows hosting starts from $5/month only. We also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable Windows server 2012 Hosting, we should be your best choice.

How To Fix Windows Script Host access is disabled on this machine

If you receive this Windows Script Host access is disabled on this machine, Contact your administrator for details message box, on your Windows 10/8/7 computer, then this post may interest you. Today we will see how you can enable or disable Windows Script Host.

Windows Script Host access is disabled on this machine

Windows Script Host or WSH, is a Microsoft technology that provides scripting abilities like batch files, but includes many more features. Such Scripts can be run directly from the desktop by double-clicking a script file, or from a command prompt. It can be run from either the protected-mode Windows-based host wscript.exe, or the real-mode command shell-based host cscript.exe.Several “HTML malware” have been reported to use WSH objects as a result of which, those who do not require this feature, tend to disable it. But disabling WSH, will prevent users from running any scripts, including VBScript and JScript scripts, that rely on this technology – and some software may require this feature to be enabled.

Enable, disable Windows Script Host

To enable or disable Windows Script Host, type regedit.exe in Run box and hit Enter to open the Registry Editor.Navigate to the following key:

HKEY_LOCAL_MACHINE\Software\Microsoft\Windows Script Host\Settings

In the right panel, you will see Enabled. If you see the entry 0, it means that the Windows Script Host access is disabled on your Windows machine.

Double Click on it and give it Value Data 1 to enable it.

A value of 1 will enable Windows Script Host

A value of 0 will disable Windows Script Host.

Click on OK and exit the Registry. If you don’t see this entry, then you may need to create it, as it does not exist by default in Windows.You will now, no longer receive the Windows Script Host access is disabled on this machine.

ASPHostPortal.com

ASPHostPortal.com provides our customers with Plesk Panel, one of the most popular and stable control panels for Windows hosting, as free. You could also see the latest SilverLight hosting, a crazy amount of functionality as well as Large disk space, bandwidth, MSSQL databases and more. All those give people the convenience to build up a powerful site in Windows server 2008. We offers Windows hosting starts from $5/month only. We also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable Windows server 2008 Hosting, we should be your best choice.

Easy tips to protect your WIndows PC from hackers and malware

In the news recently there have been some high-profile security scares for computer users. Common sense alone isn’t enough to protect your Windows PC from malware – malicious software that disrupts your computer’s operations or gathers sensitive information about your online behaviour.Hackers can attack your PC in so many different ways that employing several layers of anti-malware protection is the only way to keep your PC malware-free when it’s online.Here are seven steps to protect your computer from Malware. Check out the video above to find out more.

Tip 1: Install, update and use anti-virus software

Installing antivirus software may sound like an obvious first step to protect against malware, but not everyone bothers to do it. With so many options now available, though, there really is no excuse. Microsoft offers its own free download in the form of Microsoft Security Essentials for Windows Vista and 7, while Windows 8/8.1 has Microsoft Defender built in.Once installed, it’s vital to regularly update your anti-malware software’s database and run system scans at least once a month.

Tip 2: Keep Windows up to date

Hackers often discover new ways to bypass Windows’ built-in security features, which is why Microsoft issues small operating system updates every Tuesday and larger ‘service pack’ updates once or twice a year. These will be downloaded and installed automatically by Windows update, but only if this feature is properly configured.To check that it’s working normally, type Windows Update in the Start menu search box in Windows Vista/7, or at the Start screen in Windows 8/8.1. Look on the left of the Windows Update window and click Change settings and use the drop-down list to check that Install updates automatically is selected - anything other than this risks a crucial update being missed.

Tip 3: Turn on the Windows firewall

Windows has a built-in ‘firewall’ that protects your PC from unwanted attention via the internet. This software firewall is enabled by default and works alongside any hardware firewall that’s built into your home broadband router. Check its settings by typing “check firewall” in the Start menu search box or on the Windows 8 Start screen and choosing Check firewall status from the results.Two green tick marks mean the firewall is working normally, else you’ll need to select Turn Windows Firewall on or off on the left of the window and enable one or both options that appear.

Tip 4: Use the latest version of your web browser

Web browsers are vital applications, but just like other software, they can contain bugs. Hackers are quick to capitalise on these and create bogus (or infect genuine) web sites with data designed to exploit them. Once a web browser has been compromised in this way, a hacker can monitor everything you type, including passwords to credit card numbers. That’s why it’s vital to use the latest version of your web browser - anything other than this may be a security risk.Microsoft includes updates for Internet Explorer. Search for Windows Update and check its optional updates section to ensure you’re also using the latest version of the application - which is Internet Explorer 11, if you’re using Windows Vista, 7 or 8/8.1.

Google Chrome and Mozilla Firefox will also update themselves automatically, but don’t ignore their requests to restart the browser when such an update has been downloaded and is ready to be installed.Emails that appear to be from a recognisable online service asking you to log into a site to confirm some personal details are always fake. These emails are usually caught by your email application’s spam filter, but if one does slip through and you click its link, your web browser should detect and block the site it takes you to. This does depend on your web browser being aware of the fraudulent site, though, which is another good reason to always use the most recent version.

Tip 6: Use the Windows Malicious Software Removal Tool

If you suspect your PC has succumbed to malware and your anti-malware software doesn’t detect it, there are two steps to take.The first is to download and run the Microsoft Malicious Software Removal Tool from the Windows Download Centre. This will detect and remove specific types of malware and is very simple to use, although it isn’t a replacement for a full anti-malware application.

Tip 7: Still infected? Use a boot CD.

Some malware can hide within Windows and make itself difficult to detect and remove. If your own anti-malware software and the Windows Malicious Software Removal Tool fail to shift it, you’ll need to download and burn a free anti-malware boot CD – refer to your computer’s manuals for instructions on how to boot from a CD as the process varies from manufacturer to manufacturer.

ASPHostPortal.com

ASPHostPortal.com provides our customers with Plesk Panel, one of the most popular and stable control panels for Windows hosting, as free. You could also see the latest .NET framework, a crazy amount of functionality as well as Large disk space, bandwidth, MSSQL databases and more. All those give people the convenience to build up a powerful site in Windows server 2008. We offers Windows hosting starts from $5/month only. We also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable Windows server 2008 Hosting, we should be your best choice.

How to find the License Agreement for the Installed version of Windows

When you install Windows, you are shown the Windows license agreement that provides all the legal language about what you can and cannot do with Windows and the responsibilities of Microsoft. Recently I wanted to read the license agreement again for Windows and I surprisingly found it difficult to find it.With that said, I put together this guide to show how you can find the license agreements for all editions of your currently installed Windows version and read it.The first step is to identify the version of Windows currently installed on your computer. If you already know what version of Windows you are using, you can skip here. Otherwise, in Windows 7 and Windows 8, you can left-click on the Start Menu, then right-click on Computer, and then select Properties. For Windows 10, right-click on the Start Menu and then left-click on the System option.You will now be shown the System control panel that provides information on what version of Windows you are running as shown below.

As you can see from the above image, I have Windows 7 Ultimate installed on my computer.Now that we know what version of Windows we are running we can open the folder that contains all of the license agreements for this version of Windows. To do this, click on the Windows (Windows Key) key, and while holding it down, click on the R key to open the Run dialog as shown below.

When the Run dialog box opens, you want to paste the following into the Open: field so that it looks like the image above

c:\windows\system32\en-US\Licenses\_Default

When ready, press the OK button and a folder will open that shows individual subfolders for every edition of the Windows version installed on your computer. Each of these folders contain the respective license agreement for that version of Windows.

Scroll through the list of folders and double-click on the one that corresponds to the edition of Windows that is installed on your computer. When the folder opens, it will contain a single file called license.rtf. This file is the license agreement for your version of Windows and you can double-click on it to view it in Wordpad or Word, if it is installed.

You can now read the agreement, print it, or email it as needed.

ASPHostPortal.com

ASPHostPortal.com provides our customers with Plesk Panel, one of the most popular and stable control panels for Windows hosting, as free. You could also see the latest .NET framework, a crazy amount of functionality as well as Large disk space, bandwidth, MSSQL databases and more. All those give people the convenience to build up a powerful site in Windows server 2008. We offers Windows hosting starts from $5/month only. We also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable Windows server 2008 Hosting, we should be your best choice.

About ASPHostPortal.com

We’re a company that works differently to most. Value is what we output and help our customers achieve, not how much money we put in the bank. It’s not because we are altruistic. It’s based on an even simpler principle. "Do good things, and good things will come to you".

Success for us is something that is continually experienced, not something that is reached. For us it is all about the experience – more than the journey. Life is a continual experience. We see the Internet as being an incredible amplifier to the experience of life for all of us. It can help humanity come together to explode in knowledge exploration and discussion. It is continual enlightenment of new ideas, experiences, and passions