|
Can you share few information?
1. What code is present in your Application_Error? If you remove everything in it and place debugger, does it hit the method?
2. IIS7? CustomError mode in Web.config?
3. Are other methods of Global.asax getting triggered, like Session_start?
4. Is there any other .config file in your application?
|
|
|
|
|
My Application_Error contains 3 lines - Server.GetLastError , Server.Transfer and Server.ClearError .
I tried removing all these lines and simply put a return statement on a breakpoint, but it did not hit.
My development environment is IIS 5.1, Windows XP, Visual Studio 2010.
I tried both with customError mode="Off" and customError mode="On" with the same results.
Session_Start is being called in Global.asax and I checked it by placing a breakpoint.
I only have a web.config file.
I created another sample file and tried it with the same results.
I have shared the sample for you if you have the time.
https://docs.google.com/file/d/0BwxeXZOAvlxJa3AxMUIxVkVUSEk/edit?usp=sharing[^]
You can download it by selecting File -> Download.
Since I'm not a web developer, my current solution is to place a try...catch and then redirect to the error page from the catch handler.
This works for me.
Any help would be appreciated.
Thanks for your time.
|
|
|
|
|
Hi Santosh,
I downloaded it and opened in my VS2010 as a website. Set the break points in Global.sax. Built and ran.
Guess what? It hit the Application_Error method.
Am I missing something or you are?
Please re-run the application that you shared with me with breakpoints and see again.
|
|
|
|
|
I'm definitely missing something.
It still gave me the same behavior.
So to make sure, I used Windows 8 and Visual Studio 2012.
I created a new application and it still gave me the same behavior.
It hit Session_Start , but did not hit Application_Error .
While debugging the error is shown in Default.aspx.cs and it says SqlException was unhandled by user code and Could not find stored procedure 'StoredProcedure2'.
If I use a try...catch and re-throw the exception from the catch handler, it hits Application_Error .
Anyway, thanks for your time.
|
|
|
|
|
I suspected some configuration issue here because the machines were used a lot before and so installed a fresh copy of Windows 8 and Visual Studio 2012.
Now I'm able to get it to work.
Thanks for your time.
However, I have one question.
Why is the debugger showing an exception in the .cs file before hitting Application_Error ?
Application_Error is hit only when F5 is pressed again after the exception is shown.
The exception can be see here - https://docs.google.com/file/d/0BwxeXZOAvlxJc28teld2R1BkVEk/edit?usp=sharing[^]
|
|
|
|
|
Now, since you share further steps, try to disable all code exceptions in VS:
Do Cntrl+Alt+E in Visual Studio and then uncheck all - Application_Error should get hit. I guess it does not work otherwise.
Worth a shot?
|
|
|
|
|
Thanks Sandeep,
It worked perfectly.
|
|
|
|
|
«_Superman_» wrote: It worked perfectly.
Awesome!
Glad I could help you out.
|
|
|
|
|
Hello Friends,
I have one query,If i use a multi-user system in that on main page there is a dashboard consider it as a grid in that grid value of xyz table is displayed.
As it is a multiuser system in that data can be inserted in that xyz table, if any user inserts data in the xyz table as soon as the user inserts the data the changes gets automatically reflected in main page dashboard.
Just like mail systems of gmail and all.
|
|
|
|
|
GridView Auto Refresh
In this tutorial i will let you know how to auto refresh or update GridView using AJAX Timer and UpdatePanel in asp.net. In this it is described that how a GridView is update after a specific time set in timer control.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Timer ID="Timer1" Interval="10000" runat="server" ontick="Timer1_Tick">
</asp:Timer>
<div>
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
</div>
<asp:Label ID="update" runat="server" Text="Label"></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Timer1_Tick(object sender, EventArgs e)
{
databind();
update.Text = " Gridview Was Last Updated at " + DateTime.Now;
}
public void databind()
{
string strcon = ConfigurationManager.ConnectionStrings["con"].ConnectionString;
SqlConnection conn = new SqlConnection(strcon);
conn.Open();
string str = "select * from dept";
SqlCommand cmd = new SqlCommand(str, conn);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
}
}
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
{
string sss = "xxx";
Response.AppendHeader("Refresh", "2");
if (!IsPostBack)
{
}
}
|
|
|
|
|
How to support the e-signature pad with crystal report and get the sign in asp.net?
|
|
|
|
|
Hi,
I am trying validating emailID against database without refreshing the page and without using the update panel.
I want to do it by client side script.
Is it possible?
Thank You.
|
|
|
|
|
|
|
Hi,
I am getting the below error in my ASP.NET 4.0 web application:
Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster.
I started getting this error when I added the below tag in web.config to encrypt the viewstate:
<pages enableEventValidation="true" controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" enableViewStateMac="true" viewStateEncryptionMode="Always"/>
<machineKey validationKey="9EFA2D2E71A1BC8ECAF76E2377F29E61AB0214D893EBDBBD49C594A94FB0A2336BA3023F1578BFFE7ACD09C56872885537D07F5FA8FFF0FE4CD8B0E955A02845" decryptionKey="3EBF84F260F8883A69379502DF6DC999ADCAAA90885EAB1BD0423CEED13526A4" validation="SHA1" decryption="AES"/>
I looked for lot of solutions on aspnet forums and Internet but nothing worked. If I change the viewStateEncryptionMode to "Auto" or "Never", then the page loads fine. But that would make my application insecure and security is my prime objective.
FYI:My application is deployed on a Windows 2008 R2 server and not on a webfarm.
Any solution to solve this issue?
|
|
|
|
|
First, just to check the simplest solution, you aren't posting back "old" pages are you? By this I mean getting the page when the viewstateEncryptionMode is off/auto, switching the mode to on then posting back. This wide cause the error, but is unlikely Tokyo are doing this.
This problem is ringing a bell, but I can't place my finger on it. You might be suffering from this http://blogs.msdn.com/b/tom/archive/2008/03/14/validation-of-viewstate-mac-failed-error.aspx (On my mobile so can't make clickety),though this was fixed IIRC.
|
|
|
|
|
Are you using Shared Hosting Environment?
|
|
|
|
|
Hi Karthick,
Are you asking whether our web server hosts other applications also apart from the application I am talking about here. If you agree to this, then my answer is yes.
|
|
|
|
|
no i am asking about the type of hosting..Where its leased or own.
|
|
|
|
|
|
k.. any particular page is displaying this error or whole application
|
|
|
|
|
I am seeing this issue only on particular pages and not all. Is there something I should specifically check on those pages?
|
|
|
|
|
yes..If ur using data reader ..make sure that connection is closed..
|
|
|
|
|
Hi
I am trying to create a column that will always have remaining width. However I want it consist of 3 divs as the middle div will always fill the width available where as the left and right divs will be a fixed width. The problem I have is that the middle div which has remaining width knocks the other divs onto a new line. How can I prevent this?
Appear on Left, this would be fixed width
Always be remainging width
Appear Right, this would be fixed width
note :
something the left div will have no controls in it.
many thanks in adavance
|
|
|
|