G
Guest
Hi,
I have a major issue with the way |DataDirectory| gets substituted when used
in a connection string in web.config. In a simple scenario when a precompiled
web site xcopied to a target web server (e.g. to a staging or production web
server). It seems |DataDirectory| still gets substituted with the path of
App_Data directory on the source web server and not the target server’s
App_Data directory.
For example this is what I have in my web.config file:
connectionString="Data Source=.\SQLExpress;Integrated Security=True;User
Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf"
when I compile the application on the development box and then copy it to
the staging server, when I run the application and try to access the
database, it generates an error message showing the path of aspnetdb.mdf on
the development box which is obviously different on the staging server. In
other words it tries to resolve the |DataDirectory| with the value from the
source server not the target server.
Thanks,
PJ
I have a major issue with the way |DataDirectory| gets substituted when used
in a connection string in web.config. In a simple scenario when a precompiled
web site xcopied to a target web server (e.g. to a staging or production web
server). It seems |DataDirectory| still gets substituted with the path of
App_Data directory on the source web server and not the target server’s
App_Data directory.
For example this is what I have in my web.config file:
connectionString="Data Source=.\SQLExpress;Integrated Security=True;User
Instance=True;AttachDBFilename=|DataDirectory|aspnetdb.mdf"
when I compile the application on the development box and then copy it to
the staging server, when I run the application and try to access the
database, it generates an error message showing the path of aspnetdb.mdf on
the development box which is obviously different on the staging server. In
other words it tries to resolve the |DataDirectory| with the value from the
source server not the target server.
Thanks,
PJ