Link to home
Start Free TrialLog in
Avatar of andrewting
andrewting

asked on

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

Hi,

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

[WebMethod]
public string HelloWorld()
{
      this.Context.Response.Redirect ("http://www.hp.com", true);
      return "hello world";
}

But invoking the method gives me a

HTTP 500 - Internal server error
Internet Explorer


What am I doing wrong?

THANKS!
Andrew

SOLUTION
Avatar of maXXXeE
maXXXeE

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Type25
Type25

You might want to look at WebRequest  to return the website.
Avatar of andrewting

ASKER

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?  

THANKS!
Andrew




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.
https://www.experts-exchange.com/questions/21378882/How-to-programatically-log-into-a-forms-authenticated-website.html