Solved

How do I send execution debugging messages to my defult page?

Posted on 2011-09-12
9
170 Views
Last Modified: 2012-05-12
I've uploaded my ASP. NET 3.5 (C#) application to the goDaddy server. based on some data in my database, my default page should display that data. Currently, when my page loads no data is showing even though there is data in the database. With the I/O on this server being as "fickle" as it is, right now, i'm just looking for some code i can write in my code behind files, to display some text / info about where in the execution path the app is as it's moving so that I can see maybe where the break down is occurring, I truly don't know if i'm getting connected to my database. In other words i don't know if the connection string i'm using is working, or if it's bombing out in the background and just eating the exception before i can see it. So are there some statements i can write that will just display some text telling me where the app is in the execution path? Or any other ways I can test that my db is connected correctly?
0
Comment
Question by:mikesExpertExchange
  • 5
  • 4
9 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 36526068
Do you already have this working on a development server somewhere else?  Do you have classic ASP or PHP enabled on your Godaddy server?  If you do I can give a simple file to check the database connection.  What I normally do first is make a simple page that returns the first 10 or 20 rows of a table so that I can see that the connection works.
0
 
LVL 1

Author Comment

by:mikesExpertExchange
ID: 36526278
@daveBaldwin: i don't have classic ASP enabled or PHP, just ASP .NET 3.5 i can enable it though, so if you want to give me the file i'll run it and see what happens. I have the option to choose ASP.NET 1.1, which I assume is classic ASP.
0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 36526328
Classic ASP is before even ASP.NET 1.1, it's not a .NET technology.  It has to be specifically enabled on IIS7 which it is on my Godaddy shared hosting account.  The reason I suggested those was because they are independent of the ASP.NET settings.
0
 
LVL 1

Author Comment

by:mikesExpertExchange
ID: 36526445
sorry...I should've knew that...I can see about enabling it. not sure how long that will take...
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 500 total points
ID: 36526510
Here's the ASP file, save as 'view20.asp'.  This is based on one of my simple database tables so you will have to change the SELECT statement, the <%response.write oRs.Fields("...").Value %> statements, and the connection info.  I use the same exact connection info in a PHP file that displays the same table.
<%@ LANGUAGE = VBScript %>
<%  Option Explicit		%>
<% 
Dim svrHere
svrHere = Request.ServerVariables("SERVER_NAME")
 %>

<html>
<head>
<title>ASP/MSSQL</title>
<style type="text/css">
<!-- 
body {color: #000000; background-color: #ffffff; font-family: Arial; margin-top: 1px;}

A {color: #000000; text-decoration: none;}
A:link {color: #000080;}
A:visited {color: #000080;}
A:hover {color: #ffffff; background-color: #000080;}
A:active {color: #000080; }

.nav {color: #ffffff; font-family: Arial; font-size: 12pt; text-decoration: none; background-color: #5577bb;}
.nav A {color: #ffffff; font-family: Arial; font-size: 12pt; text-decoration: none; background-color: #5577bb;}
.nav A:link {color: #ffffff;}
.nav A:visited {color: #ffffff;}
.nav A:hover {color: #000080; background-color: #ffffff;}
.nav A:active {color: #ffffff; }
 
-->
</style>
</head>

<body>

		<!-- Display Header -->
<table border="0" cellpadding="0" cellspacing="0" summary="">
<tr valign="top">
<td>
<h2 align="center" style="margin: 1px;">ASP/MSSQL</h2>
<%
Dim choose
Dim oConn, oRs, xRs, Lstr
Dim SQLstr, connectstr, providerName
Dim db_name, db_username, db_userpassword
Dim db_server
Dim fieldname, tablename

db_server = "xxxx.hostedresource.com"
db_name = "your-database"
db_username = "your-user"
db_userpassword = "your-password"

fieldname = "DisplayName"
tablename = "websitelist"

Dim i,j, x
i = 0
j = 0

' Create ADO Connection Component to connect to database

connectstr = "Provider=SQLNCLI;Server=" & db_server & ";Database=" & db_name & ";Uid=" & db_username & ";Pwd=" & db_userpassword & ";"

Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr

' -------- get position and defaults ----------
Dim cpos, esize
esize = 20
Lstr = "SET ROWCOUNT " & esize

Set xRS = oConn.Execute(Lstr)

' --------- Get data from table ---------------
' Execute a SQL query and store the results
' within recordset
SQLstr = "SELECT ent_num, DisplayName, Sortname, WebSite, Descript, Cat," & _
	"Approved FROM websitelist"
	
Set oRS = oConn.Execute(SQLstr)

	%>
&nbsp;<small>{&nbsp;<%=db_server %>&nbsp;}&nbsp;&nbsp;<%=SQLstr %></small><br>

<table border="0" cellpadding="0" cellspacing="1" summary="" width="960px" bgcolor="#336699" style="font-family: Arial; font-size: 11pt;">
<tr bgcolor="#5577bb" class="nav">
<th>&nbsp;ID&nbsp;</th>
<th>&nbsp;DisplayName&nbsp;</th>
<th>&nbsp;WebSite&nbsp;</th>
<th>&nbsp;Descript&nbsp;</th>
<th width='73px'>&nbsp;Cat&nbsp;</th>
<th width='73px'>&nbsp;App&nbsp;</th>
</tr>
	<%  
	if not oRS.EOF then
	j = 0
	while not oRS.EOF  %>
	<tr bgcolor="#ffffff">
	<td>&nbsp;<%response.write oRs.Fields("ent_num").Value %></td>
	<td>&nbsp;<%response.write oRs.Fields("DisplayName").Value %></td>
	<td>&nbsp;<%response.write oRs.Fields("WebSite").Value %></td>
	<td>&nbsp;<%response.write oRs.Fields("Descript").Value %></td>
	<td>&nbsp;<%response.write oRs.Fields("Cat").Value %></td>
	<td>&nbsp;<%response.write oRs.Fields("Approved").Value %></td>
	</tr>
	<% oRs.MoveNext
	j = j+1 
	wend
	oRS.close
	end if
	%>
</table>

</td>
</tr>
</table>
<%'=SQLstr %><br>

</BODY>
</HTML>

Open in new window

0
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 36526511
I tried to give you a simple aspx file but the 'ASPcompatible' isn't allowed on my hosting.
0
 
LVL 1

Author Comment

by:mikesExpertExchange
ID: 36526535
thanks. I'll request to have a temporary switch to classic ASP to test the connection string...
0
 
LVL 1

Author Comment

by:mikesExpertExchange
ID: 36526595
I spoke with godaddy and since I don't have shared hosting, they can't enable classic ASP for my account. but I will try to created a simple page to pull a few records from the data base just to test the connection string...
0
 
LVL 1

Author Closing Comment

by:mikesExpertExchange
ID: 36576681
thanks for your help...
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now