0

I am using MVC4 and I have a form page, when user click submit button I want to take all information and send a web service(in background) and show a message page. Everything is okey but in controller page doesn't run this url. There isn't any error but is doesn't work.

return Redirect("http://ww.example.com./webservices/addlead.php?action=Exp&first_name=" + r.Name + "&last_name=" + r.Surname + "&phone=" + r.Telephone + "&hash=" + r.HashCode);
3
  • you're trying to redirect a web service to an external url? I'm pretty sure you can't do that nor is that what you really want to do Commented Apr 4, 2013 at 14:15
  • Yes I'm trying to redirect a web service to an external url. How else can I do? The user sees the page unchanged? Commented Apr 4, 2013 at 14:21
  • what good would redirecting a web service do? You're telling a process that is a separate request from the clients request to redirect. The only thing that would see the response is the server. If you need to send data to example.com then you need to use a WebClient to make a post Commented Apr 4, 2013 at 14:23

1 Answer 1

2

You are missing a w in www.

return Redirect("http://www.example.com/somepage")

But If you want to make a call to the webservice to do something, you should better create a proxy class of it and using that, you can call the webservice. Make your call, get the results and return the results (appropriate view / json /some other type) back the the user.

You may also look into the WebClient class which has methods to acccess external resources.

Sign up to request clarification or add additional context in comments.

4 Comments

The URL seems just an example instead of a production one, so I would not be so sure that this is an issue.
you need to create a proxy and call your webservice.
"create a proxy and call your webservice" Is there any example about it? I can not find.
when you add your web service as a web reference, VS will create proxies for you.asp.net/web-forms/videos/how-do-i/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.