server.mapPath
-
hi, i did my database connection in a class. so how do i use the relative path
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("Cercon.mdb") + ";";
? is there a namespace for me to add in order to use server.mappath? Chris -
hi, i did my database connection in a class. so how do i use the relative path
"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("Cercon.mdb") + ";";
? is there a namespace for me to add in order to use server.mappath? ChrisSystem.Web.HttpContext.Current.Server.MapPath(string path) Keep in mind that the Server object is only available during a request plus its only available for part of that request. It may be preferable to have your database component request, or have a point of entry for the connection string. This will help you to avoid placing dependencies on the System.web.dll in your database components assembly. My own preference is to have a static event on the db component that i set up a handler for in the HttpApplications start event. This event handler returns the connection string to the component. Regards, [worldspawn]