简体   繁体   中英

Is it safe to create a static file on asp.net?

I get an asp.net project (sitecore) where my client does not have a license to run the project on localhost. So I have to do development directly on the server / portal azure by app service editor

My client wants to add 2 new pages. so I do it like this

On the root of project, I make new folder. The name is static folder. Then I make the html file. The name is test.html

Then on the Web.config , I add like this:

  <system.webServer>
    ...
    <httpRedirect enabled="true" exactDestination="true" httpResponseStatus="Found">
       <add wildcard="*/Investor" destination="/static/test.html" />
    </httpRedirect>
  </system.webServer>

I try like that and it works

Is this way good and safe? or is there a better way? I have no other options

The good and safe ways to do it are either (a) deploy to development environment, test, and promote upward to staging and then production, or (b) blue/green deployment. Editing directly on the production server is never a good idea.

Editing web.config, adding a folder to root, and making other changes to the site may seem seamless to you, but under the covers you may be triggering the application to recycle on the fly or recompile. If your application is stateful, this could cause users to be spontaneously logged out (best case) or experience strange and intermittent behavior (worst case).

I understand your client is playing it cheap here, so they need to understand that the practice they are forcing you to follow is neither good nor safe.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM