Click here to Skip to main content
15,909,898 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Custom validator [modified] Pin
diacoboss24-Aug-09 4:16
diacoboss24-Aug-09 4:16 
Questionneed help with session values Pin
shankbond21-Aug-09 4:06
shankbond21-Aug-09 4:06 
QuestionConvert html to pdf in javascript or c# Pin
zeeShan anSari21-Aug-09 2:13
zeeShan anSari21-Aug-09 2:13 
AnswerRe: Convert html to pdf in javascript or c# Pin
annathor21-Aug-09 2:39
annathor21-Aug-09 2:39 
GeneralRe: Convert html to pdf in javascript or c# Pin
zeeShan anSari21-Aug-09 2:50
zeeShan anSari21-Aug-09 2:50 
QuestionHow to share session over multiple applications Pin
Kuricheti21-Aug-09 1:30
Kuricheti21-Aug-09 1:30 
AnswerRe: How to share session over multiple applications Pin
Vasudevan Deepak Kumar21-Aug-09 3:06
Vasudevan Deepak Kumar21-Aug-09 3:06 
QuestionException Grabbing in ASP.NET Pin
Vimalsoft(Pty) Ltd21-Aug-09 0:57
professionalVimalsoft(Pty) Ltd21-Aug-09 0:57 
Good Day all

In my Application there some error that i dont want my users to see, what i do i send them to myself as an e-mail. that is working. now i want to send the description of the Error to myself. The First thing i do when there is an unhandled exception, i send a user to another page and send an e-mail to myself. i was able to compile a subject and the i want to get the Exception in the Body of my e-mail. How can i get the Error Description of the Page.

First i Made sure the when there is an Error i will redirect the users to a certain page like this
<customErrors mode="On" defaultRedirect="Error.aspx">
    <error statusCode="403" redirect="Error.aspx"/>
    <error statusCode="404" redirect="Error.aspx"/>
</customErrors>


now in the page load if the page i have this
protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
    {
        Send_log();
    }
}


and my method is defined as

private void Send_log()
    {
           String Client_URL = GetCurrentPageName(); //This is used Because we needed to know where was the Exception comming from(Client)

            Exception objErr = Server.GetLastError();
         
            MailMessage mm = new MailMessage();

            SmtpClient smtp = new SmtpClient();

            mm.From = new MailAddress("vuyiswamb@gmail.com");

            mm.To.Add(new MailAddress("Vuyiswa@its.co.za"));

            // mm.To.Add(new MailAddress("abacussupport@its.co.za"));

            mm.Subject = "Exception Report from " + Client_URL + "In EXAM/CLASS";

            mm.Body = objErr.ToString();

            mm.IsBodyHtml = true;

            smtp.Host = "smtp.gmail.com";

            smtp.EnableSsl = true;

            System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential();

            NetworkCred.UserName = "vuyiswamb@gmail.com";

            NetworkCred.Password = "wow";

            smtp.UseDefaultCredentials = true;

            smtp.Credentials = NetworkCred;

            smtp.Port = 587;

            smtp.Send(mm);
   }


Now the Problem is in this object
Exception objErr = Server.GetLastError();


it always brings back nulls. now.Now am testing this Methiod with a page not Found Error , something like this

Response.Redirect("MissingPage.aspx"); 


Thanks

Vuyiswa Maseko,

Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."

C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.somee.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/

AnswerRe: Exception Grabbing in ASP.NET Pin
Blikkies21-Aug-09 1:25
professionalBlikkies21-Aug-09 1:25 
QuestionHow To Validate The Textbox without Using Special charecters Pin
axman_podili@yahoo.co.in21-Aug-09 0:55
axman_podili@yahoo.co.in21-Aug-09 0:55 
AnswerRe: How To Validate The Textbox without Using Special charecters Pin
Vimalsoft(Pty) Ltd21-Aug-09 1:00
professionalVimalsoft(Pty) Ltd21-Aug-09 1:00 
GeneralRe: How To Validate The Textbox without Using Special charecters Pin
Adam Maras21-Aug-09 8:43
Adam Maras21-Aug-09 8:43 
AnswerRe: How To Validate The Textbox without Using Special charecters Pin
Anurag Gandhi21-Aug-09 2:59
professionalAnurag Gandhi21-Aug-09 2:59 
Questionunable to drag contentplace holder Pin
myinstincts21-Aug-09 0:44
myinstincts21-Aug-09 0:44 
QuestionHow to lock code execution? Pin
Chesnokov Yuriy21-Aug-09 0:23
professionalChesnokov Yuriy21-Aug-09 0:23 
AnswerRe: How to lock code execution? Pin
Ashfield21-Aug-09 1:26
Ashfield21-Aug-09 1:26 
GeneralRe: How to lock code execution? Pin
Chesnokov Yuriy21-Aug-09 2:30
professionalChesnokov Yuriy21-Aug-09 2:30 
AnswerRe: How to lock code execution? Pin
Abhishek Sur21-Aug-09 9:37
professionalAbhishek Sur21-Aug-09 9:37 
QuestionHow to copy all folder contents during publishing Pin
Chesnokov Yuriy21-Aug-09 0:09
professionalChesnokov Yuriy21-Aug-09 0:09 
QuestionHow to open outlook mail window when i click emailid in my webpage Pin
kish2021-Aug-09 0:02
kish2021-Aug-09 0:02 
AnswerRe: How to open outlook mail window when i click emailid in my webpage Pin
dan!sh 21-Aug-09 0:50
professional dan!sh 21-Aug-09 0:50 
AnswerRe: How to open outlook mail window when i click emailid in my webpage Pin
Coding C#21-Aug-09 4:01
Coding C#21-Aug-09 4:01 
Questionshow image Pin
ritasaumya20-Aug-09 23:29
ritasaumya20-Aug-09 23:29 
AnswerRe: show image Pin
Jay Royall20-Aug-09 23:39
Jay Royall20-Aug-09 23:39 
AnswerRe: show image Pin
padmanabhan N21-Aug-09 0:16
padmanabhan N21-Aug-09 0:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.