Thursday, March 22, 2012
Server.GetLastError() return null
The context of the error will be available here. Your
application is handling the error, and thus there is no
LastError to Get.
hth,
-Christopher
http://weblogs.asp.net/CFrazierUsing Application_Error() does work. Thank-you!!!
What's confusing though is that I am simply trying to work
through an example on page 292 in "Developing WEB
Applications with Microsoft Visual Basic .NET and Visual
C# .NET". This example works with Server.GetLastError().
Perhaps book is wrong?
>--Original Message--
>Try using the Application_Error() event in Global.asax.
>The context of the error will be available here. Your
>application is handling the error, and thus there is no
>LastError to Get.
>hth,
>-Christopher
>http://weblogs.asp.net/CFrazier
>.
Server.GetLastError() in a Web Farm
resides on a web farm and I am trying to trap the last exception that was
thrown, I assume that Server.GetLastError() will only check for the last
error on the current server. What if I was redirected via load balancing to
a different server. How do I accomidate for this?If an exception occured, how would you get redirected to a different server?
Exception Occurs
local error handling
page error handling
global error handling
there's no redirection happening...it all happens in a single thread...
Karl
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Daniel Williams" <Daniel Williams@.discussions.microsoft.com> wrote in
message news:79CDFA4C-0E4E-41D1-8F1E-AF3CF66DF570@.microsoft.com...
> If I am handling errors in my Global.Asax Application_Error method and
this
> resides on a web farm and I am trying to trap the last exception that was
> thrown, I assume that Server.GetLastError() will only check for the last
> error on the current server. What if I was redirected via load balancing
to
> a different server. How do I accomidate for this?
Server.GetLastError() in a Web Farm
resides on a web farm and I am trying to trap the last exception that was
thrown, I assume that Server.GetLastError() will only check for the last
error on the current server. What if I was redirected via load balancing to
a different server. How do I accomidate for this?If an exception occured, how would you get redirected to a different server?
Exception Occurs
local error handling
page error handling
global error handling
there's no redirection happening...it all happens in a single thread...
Karl
MY ASP.Net tutorials
http://www.openmymind.net/
"Daniel Williams" <Daniel Williams@.discussions.microsoft.com> wrote in
message news:79CDFA4C-0E4E-41D1-8F1E-AF3CF66DF570@.microsoft.com...
> If I am handling errors in my Global.Asax Application_Error method and
this
> resides on a web farm and I am trying to trap the last exception that was
> thrown, I assume that Server.GetLastError() will only check for the last
> error on the current server. What if I was redirected via load balancing
to
> a different server. How do I accomidate for this?
Tuesday, March 13, 2012
Server.MapPath in Global.asax
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,PasswordB
ox,TreeView,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...
> save
the
database/database.mdb.
> ok,
the
> base
>
Server.MapPath in Global.asax
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