Programmatically call ImageButton_Click

.Net, ASP No Comments »

with a regular button, you can programmatically call the Button_Click by calling:

Button1_Click(Me, EventArgs.Empty);

However, with an ImageButton, you get an error if you use the above method. You need an extra line of code:

ImageClickEventArgs args = new ImageClickEventArgs(1, 1);
ImageButton1_Click(this, args);

Silverlight on IIS 6

.Net, ASP No Comments »

In order to host a Silverlight application on IIS6 you will need to add a MIME type

  • Open IIS, right-click and select properties for the Silverlight site.
  • Select the tab for HTTP Headers
  • Click on MIME Types
  • Click New and add Extension= .xaml and Mime Type= application/xaml+xml
  • Depending on the features used in your Silverlight app, you might also need to add 2 new types of
    (.xap  application/x-silverlight-app) and (.xbap  application/x-ms-xbap)

Upload file timeout

.Net, ASP No Comments »

if your webpage submits a file for uploading, and the page returns an error on larger file sizes, then look for 2 attributes to modify in your web.config .

open you web.config file and seach for the following line:

<httpRuntime executionTimeout="480" maxRequestLength="7168"/>

executionTimeout is the time limit before the request timesout and you get an error, this figure is represented in seconds (480 = 8 minutes)
maxRequestLength is the file size represented in KB (1024 = 1MB, 7168 – 7MB)

for detailed info, go to:

Connection Strings

.Net, ASP No Comments »

Access File:
 “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Work\Tools\myaccessdb.mdb;”

SQL Server:
“user id=SqlLoginName;password=SqlPW;initial catalog=yourDBname;data source=YourServerName;Connect Timeout=30”

 Data Source=ServerIP; User ID=SqlLoginName;password=SqlPW;initial catalog=yourDBname

CSV File:
 “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=”c:\tool\myfile.csv”;Extended Properties=””text;HDR=No;FMT=Delimited”””

ODBC link:

UPS shipment tracking in

.Net, ASP No Comments »

great info on tracking UPS shipment from you application

Try & Catch Blocks – Error handling in ASP

ASP No Comments »

Error and exception handling in ASP is’n that easy. There are only two basic commands which help us to deal with situations where we don’t really know what may happen.
The default behavior of the script engine is to stop when an error occurs and to send the error description to the browser. The first command is to change this behavior to “whatever happens, go on”:

On Error Resume NextIf you wish to reactivate the default behavior:

On Error Goto 0These two commands and the “err” object help us to simulate a try-catch-usage. Let’s implement the VBscript way of try and catch:

On Error Resume Next

‘Do something incorrect
Dim x
x = 3
x = x / 0

If err > 0 Then
    Response.Write “An error occurred: ” & Err.Description & ” (Error number: ” & Err & “)<br>”
End If
On Error Goto 0

Response.Write ” Result is: ” & x
As you can see here, it’s possible to deal with harmful situations. But be careful: Some programmers like it to write “On Error Resume Next” in the first line of their programs. That may be comfortable because no error will occur, but it’s not polite and makes bug fixing very hard.

 link to full article

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in