0

I have created asmx web service, which is redirects to web form. I am able to redirect to web form using .net client and through web browser.

Is it possible to fulfill through Java client?

Here is my code:

[WebMethod]
public void start(string id, string name)
{
    string finalname = name;
    Session["name"] = finalname;

    HttpContext.Current.Response.Redirect(""~/Default.aspx");

}

Is there any other method available or not? Is it possible to do?

Please help me!! Thanks

Nitesh Kothari
  • 890
  • 12
  • 27

1 Answers1

0

Why would you try to do such a thing? An web method should fulfil the request and send back a response. If it encounters an error or receives an unauthorized request just send an appropriate error code. Redirecting from within an Web Method is not a good practice.

TejSoft
  • 3,213
  • 6
  • 34
  • 58
  • I am doing for some project purpose, can you give me some suggestion please? thanks @TejSoft – Nitesh Kothari Feb 11 '15 at 06:36
  • Web Services are generally hosted stand alone so that it can be consumed by any type of clients .net, php, java etc. They can also be called by console applications, e.g. an exe on windows or a php job on linux. So, whether to redirect to "default.aspx" or "index.php" is a decision should be made by the program calling the Web Service. – TejSoft Feb 11 '15 at 06:50
  • But I tested from development web server and IIS server, its redirecting to "Default.aspx" but when it is called by Java or other client, its not redirecting. Thanks @TejSoft – Nitesh Kothari Feb 11 '15 at 06:53