ASP.NET Demo Projects Readme
OVERVIEW
MailBee.NET Objects setup program installs ASP.NET samples in "My Documents/MailBee.NET Objects/Samples/ASP.NET" folder. There are two sub-folders:
- cs_samples - C# version
- vb_samples - VB version
Each folder includes the solution and project files for Visual Studio 2008 and 2010, and also .bat files which let you compile and run the samples even if you don't have Visual Studio.
For quick access, the setup program puts shortcuts to solution files (like VS2008_CS.sln) in "Start/Programs/MailBee.NET Objects/Sample Applications/ASP.NET" menu.
HOW TO COMPILE SAMPLES IN VISUAL STUDIO
C# version
- If using Visual Studio 2008, open VS2008_CS.sln solution and build it.
- For Visual Studio 2010, open VS2010_CS.sln instead. Also, see NOTES below regarding web.config changes.
- In Solution Explorer, use Set As Start Page to set index.html as an entry point.
VB version
- If using Visual Studio 2008, open VS2008_VB.sln solution and build it.
- For Visual Studio 2010, open VS2010_VB.sln instead. Also, see NOTES below regarding web.config changes.
- In Solution Explorer, use Set As Start Page to set index.html as an entry point.
HOW TO COMPILE SAMPLES WITHOUT VISUAL STUDIO
C# version
- In Windows Explorer, open "My Documents/MailBee.NET Objects/Samples/ASP.NET/cs_samples" folder.
- If using ASP.NET 2.0/3.5, run compile_2008_cs.bat.
- If using ASP.NET 4.0, run compile_2010_cs.bat (also, see NOTES below).
VB version
- In Windows Explorer, open "My Documents/MailBee.NET Objects/Samples/ASP.NET/vb_samples" folder.
- If using ASP.NET 2.0/3.5, run compile_2008_vb.bat.
- If using ASP.NET 4.0, run compile_2010_vb.bat (also, see NOTES below).
HOW TO RUN SAMPLES
With ASP.NET Development Server (Visual Studio built-in)
- Open the solution in Visual Studio.
- If not done before, set index.html as start page so that it would load automatically instead of directory
listing.
- Start the solution.
With IIS 5 (e.g. Windows XP)
- In IIS Manager, create a virtual directory (let's say, "mailbee") for cs_samples
or vb_samples physical folder.
- Register it as Application in virtual directory properties (by clicking "Create"
in "Application Settings" section of "Virtual Directory" tab).
- Make sure ASP.NET version for this application (selected in ASP.NET tab) is 2.0
or above.
- Use the appropriate compile_20xx_xx.bat to compile the project (for instance, compile_2008_cs.bat
to compile C# samples for ASP.NET 2.0/3.5).
- Navigate to http://hostname/mailbee/index.html where
hostname is localhost if IIS is on your computer.
- You may also need to set the appropriate permissions to enable Internet user to
access the physical folder of the samples. In Windows Explorer, grant at least Read
& Execute permissions to the user under whose context IIS is working on (can
be IUSR_<SERVER_NAME>, LOCAL SERVICE, NETWORK SERVICE, ASPNET, etc).
With IIS 6 (e.g. Windows Server 2003)
- In IIS Manager / Web Service Extensions, make sure ASP.NET v2.0 or above is enabled.
- Follow the instructions for IIS 5.
With IIS 7 (e.g. Windows Server 2008, Windows Seven)
- In IIS Manager, create Application (let's say, "mailbee") for cs_samples or vb_samples
physical folder, as shown below:
- Make sure ASP.NET version for this application (selected in ASP.NET tab) is 2.0
or above. For that, the application pool your application belongs to must use ASP.NET
v2.0 or above.
- To find out (or change), which app pool your application belongs to, check Advanced
Settings of the application, as shown below:
- To check or change ASP.NET version in app pool, select Application Pools in IIS
Manager, then select the pool your application belongs to, and click Edit:
- In Authentication section of the application properties in IIS Manager, make sure
Anonymous Authentication is enabled, and click Edit to find out which system account
is used for processing anonymous requests (there can be IUSR or Application Pool
identity):
-
In Application properties in IIS Manager, click Edit Permissions and make sure IUSR
and Application Pool identity's user have at least Read & Execute permissions
for accessing the files in the application folder.
The default name of Application Pool identity's user is "IIS AppPool\DefaultAppPool"
(for default pool). Note that both IUSR and "IIS AppPool\DefaultAppPool" are local
users of this computer, not domain users (in Select Users or Groups dialog,
click Locations... to select local computer). Also, "IIS AppPool\DefaultAppPool"
may not get listed in the local users when you search for it. You'll have to type
its name explicitly:
Note that you'll need to set permissions for both IUSR and Application Pool
identity user (although you might think you'd only need to set it for the user specified
in Authentication section).
- Use the appropriate compile_20xx_xx.bat to compile the project (for instance, compile_2010_vb.bat
to compile VB samples for ASP.NET 4.0).
- Navigate to http://hostname/mailbee/index.html where
hostname is localhost if IIS is on your computer.
- If you see "HTTP Error 500.19 - Internal Server Error The requested page cannot
be accessed because the related configuration data for the page is invalid.", some
permissions are still not set. For instance, your Internet user name may be different
(NETWORK SERVICE, and so on, especially if your IIS7 is in compatibility mode).
- If you see somewhat like "403 - Forbidden: Access is denied. You do not have permission
to view this directory or page using the credentials that you supplied.", your IIS
requires SSL connection. Use https://hostname/mailbee/index.html to
open the entry page, or go to SSL Settings in Application section in IIS Manager,
uncheck "Require SSL", and click Apply.
The samples have been tested with IIS 5, 6, 7 and ASP.NET Development Server running
ASP.NET 2.0/3.5/4.0.
These instructions are not specific to MailBee.NET Objects. These are general requirements to run ASP.NET applications.
NOTES
- The samples for .NET 2.0/3.5 (Visual Studio 2008) and .NET 4.0 (Visual Studio 2010)
use the same sets of source code files. web.config files for these versions, however,
should be a bit different. If you're on .NET 4.0, follow instructions in web.config
to make it compatible with ASP.NET 4.0 requirements.
- S/MIME samples require Full Trust permission. You'll get SecurityPermission
on other trust levels, such as High. You can change trust level in .NET Trust Levels
section of Application properties in IIS Manager (IIS 7) or edit web.config file (see Trust Levels and Policy Files for ASP.NET (IIS 6.0) on Microsoft web site for details). An advanced way is to customize
High Trust level to grant UnmanagedCode permission.