Click here to Skip to main content
15,891,033 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi all,
I am new in asp.net and my company had a project and all of this project devolopers leave from here , no one know about the project. I need to update it. Actually all are configured locally in my windowsXP system. database ,iis,project file all are here. while I am using webrequest I get an error

"The remote server returned an error: (500) Internal Server Error."

the error and code are here
Please help me
The error is

Server Error in '/ava-006' Application.<br />
The remote server returned an error: (500) Internal Server Error.<br />
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.<br />
<br />
Exception Details: System.Net.WebException: The remote server returned an error: (500) Internal Server Error.<br />
<br />
Source Error:<br />
<br />
Line 50:         End If<br />
Line 51: <br />
Line 52:         wResp = wr.GetResponse<br />
Line 53:         sr = New System.IO.StreamReader(wResp.GetResponseStream)<br />
Line 54:         Shtml = sr.ReadToEnd<br />
<br />
Source File: F:\Prajeesh\ava-006\lead.report.aging.aspx.vb    Line: 52<br />
<br />
Stack Trace:<br />
<br />
[WebException: The remote server returned an error: (500) Internal Server Error.]<br />
   System.Net.HttpWebRequest.GetResponse() +5375997<br />
   ava_006.lead_report_aging.GetReport(String strFormat, String strWeek) in F:\Prajeesh\ava-006\lead.report.aging.aspx.vb:52<br />
   ava_006.lead_report_aging.btnView_Click(Object sender, EventArgs e) in F:\Prajeesh\ava-006\lead.report.aging.aspx.vb:73<br />
   System.Web.UI.WebControls.Button.OnClick(EventArgs e) +107<br />
   System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110<br />
   System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10<br />
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13<br />
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36<br />
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3436<br />
<br />
Version Information: Microsoft .NET Framework Version:2.0.50727.3623; ASP.NET Version:2.0.50727.3618 


AND the code I use is

VB
Function GetReport(ByVal strFormat As String, ByVal strWeek As String) As String
        Dim wr As WebRequest
        Dim wResp As WebResponse
        Dim sr As StreamReader
        Dim Shtml As String
        If InStr(Request.ServerVariables("path_info"), "ava-006") > 0 Then
            wr = HttpWebRequest.Create("http://" & Request.ServerVariables("server_name") & "/ava-006/lead.report.agingsub.aspx?pFormat=" & strFormat & "&pWeek=" & strWeek)
        Else
            wr = HttpWebRequest.Create("http://" & Request.ServerVariables("server_name") & "/lead.report.agingsub.aspx?pFormat=" & strFormat & "&pWeek=" & strWeek)
        End If
        wResp = wr.GetResponse
        sr = New System.IO.StreamReader(wResp.GetResponseStream)
        Shtml = sr.ReadToEnd
        GetReport = Shtml
    End Function


Please help me why this error occur and how it solve.
Posted
Updated 24-Jun-11 3:34am
v3

Hi,
Are you working on Avayaml project for Ebsworldwide.
I have worked on this project, and as you have mentioned all the developer leave the company and you only working on this.You better ask EBS why all the developer left.if they will not be able to answer Then ask me i will tell you whole story..

Any way for any help on this peoject you can alwawys mail me

Knit.ranjeet@gmail.com
 
Share this answer
 
Put this in your web.config:

<customErrors defaultRedirect="Error.aspx" mode="Off" />


Error 500 is too generic to diagnose.

Once you do that, it will give you the precise locatoion that is causing your site to misbehave, and from that point, you can probably identify the problem and fix it.

From the looks of it though, it seems that wResp might be null, or the returned value from wResp.GetResponseStream might be null. Putting a try/catch block around the code would be a good idea...
 
Share this answer
 
v2
Comments
fjdiewornncalwe 24-Jun-11 11:03am    
[OP's answer moved to comment]
hi john,

Thanks for quick reply,
Actually the result had a list of values. While I am putting try catch the error disappear, but the result is empty.
I need the result. In my project the same kind of code using in many pages and while putting try catch get result empty

while i use this
<customerrors defaultredirect="Error.aspx" mode="Off">
also have no effect of result
fjdiewornncalwe 24-Jun-11 11:05am    
I believe that when John suggests the try/catch, you will need to look at the exception details that are returned. An empty try/catch will make the error "go away", but that should never be done. Use the try/catch to see what the underlying error really is. You could even do something as simple as Response.Write of the error message that is caught.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900