473,671 Members | 2,426 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Redirection in web service

18 New Member
Hi guys,
I need an advice ASAP. I have two asp pages with forms but I need to do processing in .NET, i.e. when user submits first form it validates all the fields and if ok data goes to database and then it redirects user to second page with some fields pre-popped. So I decided to create a web service which does everything I need with all form field values from first form but the problem is I'm not sure how to redirect user to the next form after processing is done and also having some values returned from the first form?
If web service is not a option then what do you think would help me in this case? How to process all field values using .NET? Like I said there is no CodeBehind stuff since pages are written in regular asp.

Thanks in advance.
Feb 4 '08 #1
14 2255
nateraaaa
663 Recognized Expert Contributor
Within your asp code you will need to send data to the webservice via a request object. The web service will return you a response object with whatever data you need in it. In the same asp page that you sent the request in you will retrieve the response object. Now you can verify the response object came back with data and use the values in the response to assign hidden field values or session values that you will use in the page that you redirect to. Give this a try and let us know if you get stuck on something.

Nathan
Feb 4 '08 #2
Plater
7,872 Recognized Expert Expert
You could have the webservice return a status ( like "Good" or "Error: <error>") and based on the return value the page can either redirect to that 2nd page or tell the user that they need to change something before they can proceed.

Page two can just try and get values from the database?
Feb 4 '08 #3
Dimon
18 New Member
thanks guys, I'll try it and let you know
Feb 4 '08 #4
Dimon
18 New Member
Within your asp code you will need to send data to the webservice via a request object. The web service will return you a response object with whatever data you need in it. In the same asp page that you sent the request in you will retrieve the response object. Now you can verify the response object came back with data and use the values in the response to assign hidden field values or session values that you will use in the page that you redirect to. Give this a try and let us know if you get stuck on something.

Nathan
ok so I don't really understand how to implement it, let me try to interpret what you said in code language:

Say first page has the following:

<form name="Form1" onsubmit="retur n DoValidation(th is)" action="http://www.DomainName. com/WebService1/Service1.asmx/ZipTest" method="POST">
<input type="hidden" name="UId" value="test">


ZipTest web method is doing all the processing and return entered Zip code so that second page should have Zip field pre-popped as well as value of hidden field "UId".
So when I click submit it actually does everything I need and of course it goes to http://www.DomainName.com/WebService...1.asmx/ZipTest with XML with Zip value returned which is not what I need. How then I redirect user to the Page2.

Page two can just try and get values from the database?
Retrieving values from the database is not an option due to different reasons.
Feb 4 '08 #5
Plater
7,872 Recognized Expert Expert
Are the values to be used produced by the webservice, or produced bye the first page?

Here's what I am thinking:
Page1
----------
Have your values or whatever you need and your button.
When the button gets clicked, the backend code sends the request to the webservices and gets a reply back.
If the reply is a "failure" reply, display some message to the user (or whatever you want)
If the reply is a "success" reply, it will also contain all the values you need for the 2nd page.
Take those values and populate the Session object with them.
Redirect to page2.

Page2:
----------
Read in the values from the Session object.
If the values are not in the session object, redirect to page1.
Populate your fields based on the values from the Session object.
Feb 4 '08 #6
Dimon
18 New Member
Are the values to be used produced by the webservice, or produced bye the first page?

Here's what I am thinking:
Page1
----------
Have your values or whatever you need and your button.
When the button gets clicked, the backend code sends the request to the webservices and gets a reply back.
If the reply is a "failure" reply, display some message to the user (or whatever you want)
If the reply is a "success" reply, it will also contain all the values you need for the 2nd page.
Take those values and populate the Session object with them.
Redirect to page2.

Page2:
----------
Read in the values from the Session object.
If the values are not in the session object, redirect to page1.
Populate your fields based on the values from the Session object.
Sorry, maybe this is a stupid question, but how do i do this part - "When the button gets clicked, the backend code sends the request to the webservices and gets a reply back."? That's actually what I'm trying to figure out :)
What do I put in action property? Cause currently that's what I have:

<form name="Form1" onsubmit="retur n DoValidation(th is)" action="http://www.DomainName. com/WebService1/Service1.asmx/ZipTest" method="POST">
Feb 4 '08 #7
hdanw
61 New Member
Your all going about it Wrong.( if your using asp.net)

WHEN you click on an ASP.NET button, You have already "posted" back to the server.

On the design page, double click your submit button. This takes you to the code behind file for the page. You can access the Database directly at this point. You should also have access to all of the ASp.net form fields, the session object, the application object, the viewstate information etc.

When your done pluging the info into the DB, then transfer directly to your new page. Server.transfer , or response.redire ct.

It really is easier than you are making it.

Web services are a lot handier for something like "Internet enabled applications" Your "Web Application" is already running on the server. The only reason you would need Web Services is to access or provide access to information, or functionality that is on a different server.

For example you May want to run a mail list on a different site, and have your app running on one server while issuing commands to the mail list application on another server.

also,
If you are waiting for a service request to complete, you'll notice that your page is pretty well locked up until it finishes, unless you do an asynchronous call.
Feb 5 '08 #8
Dimon
18 New Member
Your all going about it Wrong.( if your using asp.net)

WHEN you click on an ASP.NET button, You have already "posted" back to the server.

On the design page, double click your submit button. This takes you to the code behind file for the page. You can access the Database directly at this point. You should also have access to all of the ASp.net form fields, the session object, the application object, the viewstate information etc.

When your done pluging the info into the DB, then transfer directly to your new page. Server.transfer , or response.redire ct.

It really is easier than you are making it.

Web services are a lot handier for something like "Internet enabled applications" Your "Web Application" is already running on the server. The only reason you would need Web Services is to access or provide access to information, or functionality that is on a different server.

For example you May want to run a mail list on a different site, and have your app running on one server while issuing commands to the mail list application on another server.

also,
If you are waiting for a service request to complete, you'll notice that your page is pretty well locked up until it finishes, unless you do an asynchronous call.
Thanks, but if you read my first post you'll see that pages are written in regular asp and so there is no code behind page otherwise I wouldn't ask :)
Feb 5 '08 #9
hdanw
61 New Member
Thanks, but if you read my first post you'll see that pages are written in regular asp and so there is no code behind page otherwise I wouldn't ask :)
I wasn't sure whether you had thought they were the same or intentionally left off the .net.

another way is to use java, request a dummy web page, pass a query string, and build a document with the response information you want. All of this can be done without upsetting the current page. If the right response is recieved, then proceed to the next page.

Not unlike using a .net service, however, you don't need asp.net to manage the asmx file. and it will work with any code behind, pre-markup technology.


Good luck & happy coding.
Feb 5 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1414
by: José Joye | last post by:
I have made a NT Service in c# and I need to use some features provided in a legacy C library (it can be interfaced with callbacks and normal calls). So far, no problem, I used p/Invoke and all is fine. However, this library writes to stdOut/stdError. :-(( Is there a way at service startup (or later) to redirect stdOut/stdError to files so as to prevent my Service to crash? Thanks! José
52
5437
by: Gerard M Foley | last post by:
Can one write a webpage which is not displayed but which simply redirects the user to another page without any action by the user? Sorry if this is simple, but I am sometimes simple myself. Happy New Year -- Gerry
1
1227
by: masanand | last post by:
Hi I have a web page which is calling a web method through which i am tring to do redirection to other url. But i am getting error says if i use server.transer.... Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml' otherwise
9
2006
by: Nick | last post by:
Hi there, I'm passing an HTML encoded string to an URL in the query parameter. This query string works perfect in the website if you are already logged on, if you are not logged on the application calls FormsAuthentication.RedirectToLoginPage() then the URL becomes malformed. I then recieve the following error, "The return URL specified for request redirection is invalid."
2
1223
by: =?Utf-8?B?bWFyZWs=?= | last post by:
Hi I have this problem. I want to use my web serivce in the wireless network where connection is open but users have to log into the network via the web browser to use it. So there is redirectiopn into the login page and than the proper web service is open. My question is how can I configure the network or code the client to use the web service. (This server is open for users without logging in but there is still redirection). When I'm...
0
8481
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8602
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7441
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6234
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2817
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2058
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.