**********************************************************************
Tip of the Day!
Administering your SQL through Access
If you wish to administer your SQL through Access, use Access Projects,
rather than OBDC connections. It uses native OLEDB, and provides better
performance than OBDC.
**********************************************************************
Tip of the Day!
Redirecting a user to another mobile page in ASP.NET
To redirect a user to another mobile page in ASP.NET you should use:
RedirectToMobilePage("anotherPage.aspx", true);
rather than Response.Redirect, which is used on web forms.
**********************************************************************
Tip of the Day!
Using Response.Write to solve SQL errors
If you Response.Write a problem sql string then you can determine whether your error
is simply due to mistaking a variable for a string.
**********************************************************************
Tip of the Day!
How to fetch the recordcount when the table is bound to a DataSet
To fetch the recordcount when the table is bound to a DataSet, you
should use the following syntax:
myDataSet.Tables("Authors").Rows.Count
**********************************************************************
Tip of the Day!
Using the Windows Script Host Object Model to get Registry values, when
writing COM objects for ASP pages
When writing COM objects for your ASP pages, a common need is to get
Registry values. One of the easiest ways is to use the Windows Script
Host Object Model.
Set a reference under the PROJECT menu of VB to that object and then
you get can get Registry information. This example gets home page info
from IE:
Dim WSH As New IWshRuntimeLibrary.IWshShell_Class
sHomePage =
WSH.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InternetExplorer\Main\Default_Page_URL")
**********************************************************************
Tip of the Day!
by Dan Wahlin
With the introduction of ASP.NET, many Web server controls such as TextBox, DropDownList, and
Label controls are now available that generate HTML for the browser and provide an
object-oriented way to display and access data submitted by end users. While XSLT can still be
used to generate text output from ASP.NET Web Forms, it can't be used directly to dynamically
create ASP.NET Web server controls within an ASP.NET page. This is because the output of an
XSLT transformation is simply a string that is passed to the client and not handled on the
server by the ASP.NET infrastructure. I've seen many people attempt to create server controls
using XSLT without realizing that the code is passed straight to the browser without being
processed. Browsers obviously do not know how to handle code similar to the following:
**********************************************************************
Tip of the Day!
by ASPToday Editor
HTML server controls appear very like HTML tags but have, in addition,
the runat="server" attribute at the end of the HTML element. These
server controls give the web developer the functionality of the Web Form's
page framework, while retaining the ease of use of HTML tags, as they
not only create an HTML element on a web page, but also create an
instance of a server control.
For example,
Without the runat="server" attribute, this line of HTML would be parsed
into a standard HTML button. With the runat="server" attribute, it will
be parsed into an HTML server control.
**********************************************************************
Tip of the Day!
by S Hari
The .NET Framework provides us with a tool called AL.EXE which we can
use to
place an assembly in shared cache on-the-fly:
AL /i:mydll.dll
Now your dll will be placed at the proper location by the utility.
**********************************************************************
Tip of the Day!
by ASPToday Editor
You can check which version of Treeview WebControls you have installed
by viewing the Global Assembly Cache using the Windows Explorer folder
C:\Winnt (or Windows)\assembly
**********************************************************************
Tip of the Day!
by Mark Hoffman
The easiest way to copy files into the resource directory on SharePoint is to map a drive to the
Web Storage System by running the following line from a command prompt:
subst m: \\.\backofficestorage
This will map drive M to the Web Storage System. If your workspace was called "workspace1", then
you would navigate to:
M:\localhost\SharePoint Portal Server\workspaces\workspace1\portal\resources
**********************************************************************
Tip of the Day!
by ASPToday Editor
In Visual Studio.NET you can compile a component class by simply right-clicking on the project
in the Solution Explorer.
If you are writing the class by hand in a text file, you can compile it as follows:
vbc /t:library /r:System.dll /r:System.Web.dll MyComponent.vb
The /t:library parameter indicated that you want to create a DLL instead of an EXE.
The /r parameters specify any dependent assemblies you use.
**********************************************************************
Tip of the Day!
by Ian Vink
To see if an XML element exists, set a Node equal to it then see if
that Node "Is Nothing":
Set xmlNode = xmldoc.selectSingleNode("SomeNodeName")
If Not xmlNode Is Nothing Then
'Do something with the node data
End If
**********************************************************************
Tip of the Day!
by ASPToday Editor
A command allows us to define a function for the data source to perform. Using a connection,
we execute a command against the data source which may, or may not, return results. Commands
have a CommandText property that defined the command action, which might be a SQL statement.
The CommandText is interpreted based on the CommandType set for the command. If the command type
is "StoredProcedure" then the command text is interpreted as the name of a stored procedure.
If the type is "Text" then it is interpreted as a direct command.
In order for a command to be executed, it must be associated with a connection that is open at
the time the command is executed.
**********************************************************************
Tip of the Day!
by ASPToday Editor
Cookies are only sent to the server with requests for pages that are within the
same virtual path as that set in the cookie, i.e. the value of "path" and any pages
within (or below) this virtual path. The default, if a value for the "path" is not
specifically set in the cookie, is the virtual path of the page where the cookie we
created. To have a cookie sent to all pages in a site, we just use Path = " / ".
**********************************************************************
Tip of the Day!
by ASPToday Editor
A neat way of handling connection strings is to use the appSettings section of web.config:
**********************************************************************
Tip of the Day!
by Editor ASPToday
This simple snippet allows you to delete files on your hard drive from an ASP.NET page.
<%@ Page Language="VB" debug="true" %>
<%@ Import Namespace="System.IO" %>
<%
File.Delete("C:\file.txt")
Dim f As FileInfo
f = New FileInfo("C:\file.txt")
f.Delete()
%>
If you attempt to delete a file that does not exist, no exceptions are thrown unless part
of the path does not exist, in which case a DirectoryNotFoundException is thrown.
**********************************************************************
Tip of the Day!
by Editor ASPToday
The following snippet will delete a directory.
<%@ Page Language="VB" debug="true" %>
<%@ Import Namespace="System.IO" %>
<%
Directory.Delete("C:\Create")
Dim dir As DirectoryInfo
dir= New DirectoryInfo("C:\Create")
dir.Delete()
%>
If you attempt to delete a non-existent directory, a DirectoryNotFound exception
will be thrown.
**********************************************************************
Tip of the Day!
by S Hari
Here is a simple way to find out whether a given EXE file is managed or
not in a .NET Environment
1. Run the ILDASM utility with the EXE name as a parameter, for example, ILDASM test.exe
2. If the file is not managed, ILDASM will display the message, "test.exe
has no valid CLR header and cannot be disassembled."
3. If the file is managed, the ILDASM tool will run successfully.
**********************************************************************
Tip of the Day!
by Ajoy Krishnamoorthy
To validate a phone number, add a textbox control to accept the phone number, then, add a
regularexpressionvalidator control to validate the phone number textbox. You then specify
the rules in the validationexpression property as shown below:
validphone.aspx
--------------------
**********************************************************************
Tip of the Day!
by ASPToday Editor
When building an interactive form using classic ASP, a common technique is to use some
client-side script with certain controls (e.g. listbox and checkbox) to automatically
submit the