views:

52

answers:

1

I have to give the user the option to upload his own aspx and aspx.cs files on to the server, and adjusting the hyperlink to point to a page which would do the following.

Display the aspx and aspx.cs files code onto the page without actually rendering the code.

The browser should not understand anything and while reading the files to display them the method be such that nothing is processed on the server regarding the code within the files to prevent from unnecessary problems many users would try to cause.

I have tried many ways of displaying it but it ends up on displaying the actual comments instead of the code.

Please suggest with links to examples how to achieve the above.

Please note main concentration is on ASP.NET and C# using Visual Studio 2008, so JavaScript and ready-made tools should be avoided if feasible.

A: 

Set the MIME type to text/plain.

jrtc27
or, alternatively, create a text box, create a string from the file contents, and set the text box text to the string
jrtc27
forgive th ignorance but how to you set mime type? there is nothing like that in labels or any controls properties
You set the mime type using Response.ContentType
Ben Robinson