About
Pricing
Community
Teams
Start Free Trial
Log in
akoIT
asked on
11/9/2017
an unknown error has occurred while processing the request on the server. the status code returned from the server was 500
Hi All,
Can you help me resolve this issue on button click?
an unknown error has occurred while processing the request on the server. the status code returned from the server was 500
ASP.NET
5
1
Last Comment
Ryan Chong
8/22/2022 - Mon
Pawan Kumar
11/9/2017
What code you have written? Can you please share.
ASKER CERTIFIED SOLUTION
Ryan Chong
11/9/2017
THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
akoIT
11/9/2017
ASKER
Hi Pawan thanks for response. Here is the sample code.
I have a button and an gridview inside update panel.
<asp:UpdatePanel ID="sample" runat="server" >
<contentTemplate>
<button type="button" runat="server" onclick="javascript: LoadingModal();" onserverclick="GenerateRep
ort" />
<asp:GridView ID="gridViewRpt" runat="server">
</asp:GridView>
</ contentTemplate>
</asp:UpdatePanel>
CODE BEHIND:
Protected Sub GenerateReport(sender as object, e as EventArgs)
........
gridViewRpt.DataSource = cmd.ExecuteReader()
gridViewRpt.DataBind()
End Sub
when i click the button on the first time, there is no error, but when i click it again this error is occured.
akoIT
11/9/2017
ASKER
Hi Ryan Chong, how can I prevent this kind of error?
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Ryan Chong
11/9/2017
how can I prevent this kind of error?
try to verify what's the exact error generated from server end...
for example, if you can't just-in-time debugging... try do a try catch in Sub GenerateReport and send that error into a custom log file for debugging.
Just-In-Time Debugging in Visual Studio
https://msdn.microsoft.com/en-us/library/5hs4b7a6.aspx?f=255&MSPPError=-2147217396
for the custom log, we usually use
log4net
library which you can get from NuGet Manager.
log4net
https://www.nuget.org/packages/log4net/