Response.redirect to a url within web service method leads to HTTP 500 - Internal server error

Posted on 2005-04-05
Last Modified: 2011-10-03

I have a simple web service that redirects the response to a web page.

public string HelloWorld()
      this.Context.Response.Redirect ("", true);
      return "hello world";

But invoking the method gives me a

HTTP 500 - Internal server error
Internet Explorer

What am I doing wrong?


Question by:andrewting
    LVL 7

    Assisted Solution

    r u sure that u can redirect to another page in web service?

    can i know, what exactly u r trying to achieve in ur application?
    LVL 12

    Accepted Solution

    I don't think you could or should do that in a web service application.
    A web service does not have a user interface anyway, so what's the point
    of redirecting to another page?
    LVL 9

    Expert Comment

    You might want to look at WebRequest  to return the website.

    Author Comment

    Thanks for the comments.  You are right.  I thought about it a little more and redirecting to a web page in a web site is a little weird.

    I have a web site that we built, but I now need to be able to preload information into the web site by a third-party application using a web service.  I need to be able to

    1.  Programmatically log into the website (the website uses forms authentication) and load an XML file into the website via a web service.

    This should be easy a simple web service that says (and secured using SSL) should work.
    eg.  LoadXML (string userName, string password, string XML)

    2.  Start up the website in a browser (already logged in for the user) and goto an aspx page that presents the loaded information to the user.

    This is a little more confusing, how do I programmatically log a user in?  At first I thought of having a web service like above, and once the credentials are authenticated, I would redirect the user to the website page using the session information.  But this doesn't seem to be the right approach...

    I don't want to encode the username/password in the URL in plain text....Can anyone help me with this?  



    Author Comment


    I couldn't figure out how to change the title of my question.  I was worried that no one would respond.

    Here is the new link.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Suggested Solutions

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    12 Experts available now in Live!

    Get 1:1 Help Now