Omu
Omu

Reputation: 71238

is it ok to read aspx/cshtml files that are also used by the asp.net

I want the user to be able to see the source code of the page that he is on, so I'm planing to just read the file from the file system (Server.MapPath("~/Views/home/index.aspx")) and output it into html.

I'm just wondering if there is any problem with this approach, like if the asp.net process is locking the aspx/cshtml files or something like that

Upvotes: 0

Views: 180

Answers (1)

nunespascal
nunespascal

Reputation: 17724

This is perfectly alright. Asp.net does not lock onto the aspx files. It reads these files on first request, and stores in a format it IL format compiled code, and from then on only watches the original aspx for changes. If the file changes it is recompiled.

Ref: dynamic compilation

I could not find any docs to support this, but you should have no trouble if you read the aspx file.

Upvotes: 2

Related Questions