in an application variable the path of my database. Global.asax is in the
root directory of my web folder and database is in database/database.mdb.
Now, if I start my web site from default.aspx in the root folder all is ok,
but if start it with a page in a nested folder Global.asax can't find the
folder because Server.MapPath use the relative path of nested folder as base
for its search.
What can I do?
Many thanks
SebastianoUse an absolute path for the Server.MapPath argument such as
~/database/database.mdb instead of just database/database.mdb
Patrice
"Sebastiano" <info@.sebastianogazzola.it> a crit dans le message de
news:OtVprw4IEHA.3964@.TK2MSFTNGP10.phx.gbl...
> I want to use Server.MapPath function in Global.asax because I want to
save
> in an application variable the path of my database. Global.asax is in the
> root directory of my web folder and database is in database/database.mdb.
> Now, if I start my web site from default.aspx in the root folder all is
ok,
> but if start it with a page in a nested folder Global.asax can't find the
> folder because Server.MapPath use the relative path of nested folder as
base
> for its search.
> What can I do?
> Many thanks
> Sebastiano
try to use Request.PhysicalApplicationPath to combine path
--
Thanks.
Lostinet (MS ASP.NET MVP)
lostinetweb@.hotmail.com
--------
Need MessageBox,ComboBox,DatePicker,PasswordBox,TreeVie w,ASP.Net RPC ?
http://www.lostinet.com/
"Sebastiano" <info@.sebastianogazzola.it> ะด?
news:OtVprw4IEHA.3964@.TK2MSFTNGP10.phx.gbl...
> I want to use Server.MapPath function in Global.asax because I want to
save
> in an application variable the path of my database. Global.asax is in the
> root directory of my web folder and database is in database/database.mdb.
> Now, if I start my web site from default.aspx in the root folder all is
ok,
> but if start it with a page in a nested folder Global.asax can't find the
> folder because Server.MapPath use the relative path of nested folder as
base
> for its search.
> What can I do?
> Many thanks
> Sebastiano
Thank you so much, I can't understand why MS did not mention the importance
of the "~" symbol in the path request. I have waisted hours trying to look
for documentation.
- Rashad
"Patrice" <nobody@.nowhere.com> wrote in message
news:upo4Do6IEHA.3964@.TK2MSFTNGP10.phx.gbl...
> Use an absolute path for the Server.MapPath argument such as
> ~/database/database.mdb instead of just database/database.mdb
> Patrice
> "Sebastiano" <info@.sebastianogazzola.it> a crit dans le message de
> news:OtVprw4IEHA.3964@.TK2MSFTNGP10.phx.gbl...
> > I want to use Server.MapPath function in Global.asax because I want to
> save
> > in an application variable the path of my database. Global.asax is in
the
> > root directory of my web folder and database is in
database/database.mdb.
> > Now, if I start my web site from default.aspx in the root folder all is
> ok,
> > but if start it with a page in a nested folder Global.asax can't find
the
> > folder because Server.MapPath use the relative path of nested folder as
> base
> > for its search.
> > What can I do?
> > Many thanks
> > Sebastiano
0 comments:
Post a Comment