|
And copy-paste posting is soooo much better.
225 years ago, we set an example for the rest of the world by creating a country where everyone could vote... Well, except for women and black people, but we fixed that! -Adam Duritz, of Counting Crows
|
|
|
|
|
I got help anyway, so neener-f*ckin-neener.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Neat they say you learn somthing everyday. Well today is the first day that I have learned anything in a while.
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
Those links weren't the right ones, but I eventually did find the answer in a MSDN article.
MSDN Q920681[^]
-- modified at 16:47 Wednesday 23rd August, 2006
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Hello folks!
I´ve implemented some custom error handling that writes the error to a log file then redirects the user to my custom error page. The strange thing is: this all works fine when i run the project in VS2005 using f5 but when i just choose to directly go to any page causing an error (like 'view in browser') error logging still works ok but my custom error page is ignored. Instead the regular asp.net error page is used.
It´s done like this...
First the web.config:
<httpModules>
<add type="Munkeby.Web.ErrorHandlingModule, CaseComponents" name="ErrorHandler" />
</httpModules>
My httpModule:
public class ErrorHandlingModule : IHttpModule
{
private HttpApplication application;
void IHttpModule.Init(HttpApplication app)
{
this.application = app;
this.application.Error += new EventHandler(ErrorHandler);
}
private void ErrorHandler(Object sender, EventArgs e)
{
Exception ex = application.Server.GetLastError();
string errorString = "\n\n" + DateTime.Now.ToString() + " " + ex.Message + "\nInnerException: " + ex.InnerException;
TextWriter tw = File.AppendText(application.Server.MapPath("errorLog.txt"));
tw.WriteLine(errorString);
tw.Close();
application.Server.Execute("Error.aspx");
application.Server.ClearError();
}
#region IHttpModule Members
public void Dispose()
{
}
#endregion
}
And, finally the error page:
protected void Page_Load(object sender, EventArgs e)
{
Exception ex = Server.GetLastError();
if (ex != null)
lblErrorMessage.Text = ex.Message + "<br /><br />" + ex.InnerException;
}
Hope it makes sense.
/J
|
|
|
|
|
can you use the web.HttpResponse.Redirect method.
replace
<br />
application.Server.Execute("Error.aspx");<br />
application.Server.ClearError();<br />
with
<br />
HttpContext.Current.Response.Redirect("Error.aspx");<br />
how vital enterprise application are for proactive organizations leveraging collective synergy to think outside the box and formulate their key objectives into a win-win game plan with a quality-driven approach that focuses on empowering key players to drive-up their core competencies and increase expectations with an all-around initiative to drive up the bottom-line. But of course, that's all a "high level" overview of things
--thedailywtf 3/21/06
|
|
|
|
|
Unfortunately that doesn´t work. Using application.Server.Execute("Error.aspx") makes the aspnet process run error.aspx in the current page´s context, wich means that the exception is still available.
|
|
|
|
|
Hello,
In ASP.NET 2.0 how can I find the path of web.config file inside code at runtime.
For instance there is AppDomain.CurrentDomain.SetupInformation.ConfigurationFile
But in my case I cannot use this. Because, my assembly is in at different place and web config file is at different place (wwwroot)
When I use above method, I get location of assembly, not the root folder i.e. wwwroot
Appreciate any help.
Note: I need to get this path where Server.MapPath is not available.
- ashish
|
|
|
|
|
You can only get the path when MapPath is available. If it's really not available, you have to store the value when it is, so that you can get it when it isn't.
If the code is run because of a request, you can always use MapPath. You can reach it through HttpContext.Current.Server.MapPath.
MapPath("~") gets the root folder. The root may or may not contain a web.config file. Each subfolder may also contain a web.config file.
---
b { font-weight: normal; }
|
|
|
|
|
Hello Guffa,
I have my virtual dir configured at drive X and my wwwroot folder is in drive C. The webconfig file I have to keep in wwwroot folder.
I am using Enterprise Lib for caching. The ConfigurationBuilder of this uses
AppDomain.CurrentDomain.SetupInformation.ConfigurationFile to get config file path. In my case above statement does not return the value I am looking for that is, wwwroot folder path.
Inside Enterprise Lib’s ConfigurationBuilder class I do not have HttpContext available.
Hope you understand where I am.
Let me know if you have any clue, any workaround to get it running.
Appreciate your help.
- ashish
|
|
|
|
|
In addition to previous I can access right config keys by using
System.Configuration.ConfigurationManager.AppSettings
In web config only I have defined the path for appsettings.xml file and it reads properly.
- ashish
|
|
|
|
|
AshishBasran wrote: Inside Enterprise Lib’s ConfigurationBuilder class I do not have HttpContext available.
Why not? When is the code executed?
---
b { font-weight: normal; }
|
|
|
|
|
It get executed when on load of first page I try to use caching and for that from entprise lib request goes to ConfigurationBuilder for configuration section
- ashish
|
|
|
|
|
Then the code is executed as a result of a request, and you can access the current HttpContext.
---
b { font-weight: normal; }
|
|
|
|
|
hi,
I want a folder browser dialog control for asp.net. can any one help me?
sam.
|
|
|
|
|
I'm afraid that not possible without using an active x- control or a java applet on the page.
|
|
|
|
|
do u know any activeX control?
|
|
|
|
|
How would i pass values from one form to another?
Like if i want to retrieve a variable's value on the login form and use it on the home page?
thank you
Nothing lasts but nothing is lost
|
|
|
|
|
If your value is not very big then you can send it through querystring. From the login page you have to send the value through the URL and in the home page you can retrieve it from the URL.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Not a very secure method. After all the data you are passing would be in plain text attached to the url.
You could use a session variable to pass the values around
only two letters away from being an asset
|
|
|
|
|
Mark Nischalke wrote: Not a very secure method.
Quite correct. This method should only be used if the data is not that much valuable.
Best Regards,
Apurva Kaushal
|
|
|
|
|
Thank you it worked
Nothing lasts but nothing is lost
|
|
|
|
|
Always welcome..
Best Regards,
Apurva Kaushal
|
|
|
|
|
Does the session variable pass like a quary string or does the server keep track of the session variable?
Chad Dolan
|
|
|
|
|
A session variable is maintained by the server and is not passed via query string
only two letters away from being an asset
|
|
|
|