Link to home
Start Free TrialLog in
Avatar of Mariyam
Mariyam

asked on

Using Page.Trace.Write Commands

I have a VB.Net Asp.net web application developed in VS2010  in a Windows 7 environment with a SQL 2008 R2 backend.

I published it to my one of my test environments which is Windows Server 2008 running IIS 7.5 and converted the directory containing my files to an application in IIS.  The first page loads and allows me to insert text into the page text boxes but when I click on the submit button the data disappears as if the page is being reloaded instead of redirecting as instructed in the button_onclick event (server control).

In an effort to try to figure out why it's executing properly in dev but not in test I added some page.trace.write commands to find out if it's at least executing all of the lines of the _onClick code block but now the page.trace.write command appears to be causing an exception to be thrown.  What I mean by this is that before I added the Trace commands, the page executed with no exceptions but now is throwing an exception stating "Object reference not set to an instance of an object" (I had msgboxes that would display the exception information before but the app never threw an exception - I replaced them with the trace commands for deployment).  This message is rendered on line 130 as indicated in the Trace.axd file (in dev):

           130   Page.Trace.Write(ex.InnerException.ToString())

The line that throws the original exception causing  execution to branch to the Catch block is the Response.Redirect that is presently not happening in my test environment however when I attempt to examine the exception messages in dev  (Catch ex As Exception)  "ex" is "unable to evaluate" per the watch window.

My previous Page.Trace.Write commands do not cause any problems in or outside of the Try-Catch block and display properly in Trace.axd.  Most importantly, if I let execution continue after this exception is thrown, the page redirects and the application continues to execute properly all of the way to the end of the application.  Again this is in dev only, the default page just appears to reload instead of redirect in test.

I can delve into this a bit more on my own but would really appreciate it if someone could at least direct me to where I should concentrate the bulk of my effort.

TIA
-Mari
ASKER CERTIFIED SOLUTION
Avatar of Rouchie
Rouchie
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mariyam
Mariyam

ASKER

I modified my code to match yours and that caused the application to redirect to a page with the name affiliated with the redirect command but it gave a '404 Not Found' message instead of displaying the content of the page.
Can you post the full catch block so I can see what you're trying to do? Also check the URL used for the redirect starts with the tilde character.
Avatar of Mariyam

ASKER

Hi Rouchie,

Sorry it's taken me so long to get back to you.  

I copy & pasted your code as is but didn't include the tilde.  This project has been handed off so I'm not presently working on it, but as soon as I get the final disposition I'll post it here.

Thanks for you time and I'll award you the points on this question.

Take care...
-Mari