(500) Internal Server Error with C# and Web Dev 2008 Express

Posted by user32848 on Stack Overflow See other posts from Stack Overflow or by user32848
Published on 2010-01-18T19:01:39Z Indexed on 2010/06/18 6:03 UTC
Read the original article Hit count: 278

Filed under:
|

The code below is generic, found in a variety of places, including a book I have. I have used it as a base for a working program in VS 2005. Now I've resurrected it with my current Visual Web Developer 2008 Express Edition and I seem to have problems connecting it to my default development server (I don't have IIS on my XP). The error is: (500) Internal Server Error. Is this saying what I thought it did (above) or something else, and how do I solve this problem?

using System;
using System.Collections;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Net;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text.RegularExpressions;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string strResult = "";
        string url = "http://weather.unisys.com";
        WebResponse objResponse;
        WebRequest objRequest;

        try
        {
            objRequest = System.Net.HttpWebRequest.Create(url);
        }
        catch
        {
            objRequest = System.Net.HttpWebRequest.Create("http://"+ url);
        }
        objResponse = objRequest.GetResponse();

        using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
        {
            strResult = sr.ReadToEnd();
            sr.Close();
        }
    }
}

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET