Reputation: 9479
I have an interesting and rare situation. There is an single stand-alone ASPX and C sharp file I am debugging. It is not part of a project or web site.
It runs with other files and libraries within a folder of other aspx files and other supporting files. Normally I could debug the file by loading it locally in Visual Studio and attaching it to a copy of the web site running from local host. But here is the tricky part and the thorn in my side. The aspx file uses a lot of libraries that are part of the CMS system we have and the associated database is particular of what clients have access to content on the server.
So my best and immediate solution to this problem is to use some sort of method of writing out to file and/or having pop up windows to show the process. How can I do this in aspx? How can I do this in C sharp?
Upvotes: 1
Views: 226
Reputation: 3864
The easiest option would be to attach a debugger to the IIS w3wp process hosting your page and place a breakpoint in the website. You shouldn't do this on production though - it's invasive and you will block incoming requests. If you have a test environment you may try there, but remember to change recycling settings for the IIS pool (by default pools are aggressively restarted if process is not responding for few seconds - which will break your debugging session). If you don't have debugger installed on a test machine you may try copying mdbg executable and run it on server (this is quite hard) or setup a remote debugging (I also wrote a post on it here).
If the debugger option is not available then you are probably left with tracing (so called printf debugging). Place Trace.Write
commands in the code of you page and add a trace attribute to the @Page
directive: <%@ Page Trace="true" %>
. This will turn on tracing for this particular page. Finally you need to configure in web.config how you would like to access traces (more info here):
<system.web>
<trace enabled="false" pageOutput="true/false" localOnly="true/false" />
</system.web>
Upvotes: 2