Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capturing code and script from ASP

Status
Not open for further replies.

lcky

Programmer
Sep 29, 2005
30
0
0
GB
Hi

I would just like to know, is there any way to capture code and script from asp page in a browser.


many thank
 
can you please clarify your question...i didnt understand what you meant "capture code and script" ??

-DNG
 
A long long time ago... like 1998... there was a vulernability where you could basically spoof IIS into authoring mode by sending the same control string used by Visual InterDev 1.0. The problem was only with unpatched NT4 servers with remote authoring and front page extensions turned on.

With modern servers won't send any code from pages with the .asp file extension.

If you use #include files that contain sensitive information (db credentials), it is a good practice to give these files the .asp extension.
 
No, the ASP script never makes it to the browser. It is a program that runs on the server. It produces output, a stream of data that is HTML code. That HTML code is what goes to the browser.

So if you are looking to see the script that generated a page you must have access to the web server such as an FTP connection.

If you wish to present the ASP script as a web page, as an HTML page then you must prepare it as content.

This could be done in a static HTML page with a .html extension. In a file named, display_asp_code.html
Code:
<html>
<body>
Here is the ASP script<br>

<% Response.Write "Hello George." %>

</body>
</html>
This may or may not have the expected result; in Mozilla it displays as is; in IE6, the portion inside the ASP delimiters is not displayed.


The essential problem is how to display the ASP tags?
This can be done in an ASP script using Server.HTMLEncode(). In an ASP script named display_asp_code.asp
Code:
<html>
<body>
Here is the ASP script<br>
<%= Server.HTMLEncode("<% Response.Write ""Hello George."" %\>") %>
</body>
</html>
And it is necessary to use special notation for the quotation marks inside the string which is being encoded; and to escape the final bracket in the ASP delimiter in the code which is displayed.



 
ok now i understand what OP meant...and i agree with rac2.

-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top