Posted by: Imar Spaanjaars at Sunday, March 28, 2004 7:56:46 PM in:
Security
When you're working with ASP or ASP.NET applications and a Microsoft Access database, you're
likely to run into an error like this:
Microsoft
JET Database Engine error '80004005'
The Microsoft Jet database engine cannot open the file 'C:\Inetpub\wwwroot\YourSite\Databases\YourDatabase.mdb'.
It is already opened exclusively by another user, or you need permission
to view its data.
/YourSite/YourDataAccessPage.asp, line 15
Alternatively, you may get this error instead:
Microsoft
JET Database Engine error '80004005'
Operation must use an updateable query.
/YourSite/YourDataAccessPage.asp, line 15
Both errors basically mean the same: the account that your Web server
is running under does not have the necessary permissions to read from
or write to the database.
This article will explain the steps you need to perform to fix this
problem. First I will explain how you can find out the current account
that the Web server is using to connect to the database. In the second
part of the article I'll explain how to change the security settings
so the Web server can successfully access the database.
Read on ...
Posted by: Imar Spaanjaars at Monday, March 15, 2004 3:33:05 PM in:
Classic ASP
This snippet will allow you to check
whether a certain column exists in a database table or not. Useful when you're
coding against a database which schema you don't fully know. Just change the
name of the column you're looking for (nameToCheck), the
Connection String and the SQL SELECT statement, the bold items in this snippet.
Read on ...
Posted by: Imar Spaanjaars at Tuesday, March 02, 2004 6:32:40 PM in:
ASP.NET 1.x
If you have a live Web site on the World Wide Web, you may be interested
in how many people are visiting your site. You can of course analyze the
log files of your Web server but that information is usually difficult
to read. The log files contain information for each and every request a
visitor has made to your site, including resources like images, Flash movies
and so on. This makes it near impossible to extract information about individual
users. It would be a lot easier if you could count the number of individual
users that have visited you since you started your site. It would also
be useful if you could see the number of users that are currently browsing
your site.
This article will show you how to accomplish these two tasks by storing
the hit counters in shared variables in the
Global class
and in a database using code in the
Global.asax file.
The counters in the shared variables are used to display them on a page
in your Web site; either as a counter so your visitors can see it as well,
or somewhere on a page in your Admin section, so only you have access
to them. By writing the counters to a database you can maintain their value
even when you restart the Web server, while you still have a fast and scalable
solution.
This article extends
the ideas from two previous articles where the values of the counters were
just stored in
static variables in
the Global class and in a
text
file.
There are also
Classic ASP and
ASP.NET C# versions of this article available.
Read on ...
Posted by: Imar Spaanjaars at Sunday, February 29, 2004 4:36:59 PM in:
VS 2005
UPDATE (2005-12-06): The compilation features presented in this article are obsolete. It's recommended that you look at Web Deployment Projects (http://weblogs.asp.net/scottgu/archive/2005/11/10/430283.aspx) instead.
Unlike Web sites created with Visual Studio .NET 2002 or 2003, there
is no need to do a full compile of the project whenever something has
changed in your site. The new Code Behind feature and the Code directory
used in ASP.NET Whidbey allow you to make changes without recompiling.
As soon as the changed page gets requested, the .NET FRamework will recompile
the page on the fly.
However, it is sometimes useful to compile the application right after
you have deployed it. One reason for this precompilation is speed. Another
is code protection. A compiled application does not expose its source
in the ASPX pages any longer. There are two ways to compile an application
at deployment time: In-place compilation and Precompilation for Deployment
Read on ...
Posted by: Imar Spaanjaars at Saturday, February 21, 2004 11:24:02 AM in:
ASP.NET 2.0
When you have installed ASP.NET on Windows Server 2003, you may receive the following 404 - Page Not Found error:
Read on ...
Posted by: Imar Spaanjaars at Friday, February 20, 2004 10:05:37 PM in:
General
Placeholder text, use to fill in blank area's in a Web site, instead of the "content goes here" thingies.
For more information, some history and a Lorum Ipsum generator, check the
Lorum Ipsum Web site.
Read on ...
Posted by: Imar Spaanjaars at Thursday, February 19, 2004 3:06:04 PM in:
Classic ASP
The following block of code will display the properties of ALL tables in a Microsoft
Access database. For the code to run successfully, the variable
MyConnectionString needs to contain a
valid connection string pointing to the Access database.
With
this code, all tables, including system tables are displayed. If you want to
limit the list, use myTable.Type to
determine the type of the table and skip the system tables. User tables will
return "TABLE", while system tables will return "ACCESS TABLE".
If you want to display information about just a single table, remove the For Each loop and uncomment the line that starts with Set myTable. Don't forget the pass the name of the right table to the Tables collection.
Read on ...
Posted by: Imar Spaanjaars at Thursday, February 19, 2004 11:42:30 AM in:
Classic ASP
The following code shows you how to execute a Stored Procedure (called MyStoredProcedure)
in ASP without creating an explicit ADO Command object. The Stored Procedure
expects two parameters: @FirstParam (of datatype
int) and @SecondParam (of datatype varchar).
Modify the parameter list to suit your requirements
Read on ...
Posted by: Imar Spaanjaars at Thursday, February 19, 2004 10:13:58 AM in:
ASP.NET 2.0
With ASP.NET 1.0 and 1.1 many people stored their connection strings in the Web.config file under the appSettings element. But is there a better way to save these settings in ASP.NET 2.0?
Read on ...
Posted by: Imar Spaanjaars at Wednesday, February 18, 2004 8:50:30 PM in:
Web General
This article will show you how
simple it can be to send an e-mail from an ASP page. With just a
few lines of code, you can add mail sending capabilities to your ASP page
in your Web site. Notice that I put the focus on can be; depending
on your network setup, this approach may be very easy, or it may require
you to setup or configure your network for this code to work. See the reference
section at the end of this document for more information.
Read on ...