Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
| Search | Today's Posts | Mark Forums Read
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 12th, 2004, 04:33 PM
Registered User
 
Join Date: Oct 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Redirection in webservice

I am new to webservice. What I am trying to do is redirect the page in webservice?
How do I do it? It's giving error for the following code.When I am invoking it from the web service directly it works fine, but when I access from my web app it throws unhandled error.

The method in web service:
[WebMethod]

public string hello()[/size=6]
{

//string apppath;


Context.Response.AddHeader("Location","http://localhost/abcd/pageA.aspx");

Context.Response.StatusCode = 307;

return null;

}

  #2 (permalink)  
Old October 13th, 2004, 10:40 AM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I don't think this will ever work. A Web Service *can* be called from within a browser or Web app, but doesn't have to.

Redirecting is a browser / web related concept, while there are many Web service consumers that are not browser based. For instance, I can have a Windows form that calls a Web service to retrieve a DataSet. Once I receive the Redirect request, where am I redirected? Does my Win form change into a browser? I don't think so. The same is true for a Web service calling another Web service. Where do you redirect a Web service call to? You can't....

I think you'll need to rethink your strategy. For instance, have the calling code redirect the client. If necessary, have the Web service return the Ul the client needs to redirect to.

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: I'll Find My Way Home by Jon & Vangelis (Track 1 from the album: The Friends Of Mr. Cairo) What's This?
  #3 (permalink)  
Old October 18th, 2004, 11:13 AM
Registered User
 
Join Date: Oct 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I agree with Imar. I do not think your current strategy will ever work.
A Webservice is meant to be a central smart layer that does a specific task. Let the webservice return a code to the calling client, that will tell whether it failed or succeeded or return any other information that will be required for the calling client to decide where to redirect the user to.


  #4 (permalink)  
Old October 27th, 2004, 01:15 PM
Registered User
 
Join Date: Oct 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Imar and Arati, I have changed my strategy. You guys are right. I am returning a url to the client for redirection from the calling end.



Similar Threads
Thread Thread Starter Forum Replies Last Post
redirection Tomcat mohamma_reza Apache Tomcat 1 July 13th, 2007 03:40 PM
Redirection andyw ASP.NET 2.0 Basics 2 May 29th, 2006 05:23 PM
Download and Redirection wolverine4277 PHP How-To 5 December 23rd, 2004 05:32 PM
automatic 'redirection' stu9820 Flash (all versions) 4 September 20th, 2004 07:29 AM
Redirection a5xo3z1 Beginning PHP 4 June 19th, 2003 02:24 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.