How do I secure my "hibernate.cfg.xml" file? (Nhibernate). It currently sits in the route of the web app and can be viewed via the browser.
Hibernate Configuration File(cfg file) is the file loaded into an hibernate application when working with hibernate. Hibernate uses this file to establish connection to the database server.It is an XML file which is used to define below information. Standard name for this file is hibernate. cfg. xml.
Let us create hibernate. cfg. xml configuration file and place it in the root of your application's classpath. You will have to make sure that you have testdb database available in your MySQL database and you have a user test available to access the database.
Basically you are setting all the required properties via your properties object so there is no real need to tell Hibernate to look for a hibernate. cfg. xml file which is exactly what the configure() method does. it's not mandatory to use hibernate.
Yes, you can.
<configuration>
<system.web>
<httpHandlers>
<add verb="*" path="hibernate.cfg.xml"
type="System.Web.HttpForbiddenHandler"/>
</httpHandlers>
</system.web>
<configuration>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With