如何使用HTTP请求从asp.net Web服务访问ASP.net网页方法? [英] How to access ASP.net web page method from asp.net web service using HTTP request?

查看:296
本文介绍了如何使用HTTP请求从asp.net Web服务访问ASP.net网页方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI,



我在ASP.net网页上有一个方法,它返回thw字符串参数。从Web服务方法我怎样才能访问该网页使用HTTP请求的方法。

解决方案

@rahul



实际流量为



请求:ClassLibrary ------> Web服务-------->网页

回复:网页-------> webservice -------> classlibrary



in上面的流webservice从类库中获取输入并将数据添加到输入并将其发送到网页,然后网页以给定的修改输入到Web服务的相应字符串值进行响应,然后Web服务将其返回到类库。 / blockquote>

请求:ClassLibrary ------> Web服务-------->网页

回复:网页-------> webservice -------> classlibrary



TO实现这一点,我认为最好的方法是做一个response.redirect到网页。如果数据很长且很敏感,那么您想要传递给网页的任何数据都可以在查询字符串中传递,如果数据很长且很敏感,则可以将其放入会话变量中。



因此webservice可以在将所需数据放入查询字符串或会话可用之后简单地执行response.redirect或server.transfer,并且网页可以在呈现自身时获取数据。



通过这种方式,您还可以解耦Web服务并保持概念不变。如果明天有些java或php的人需要使用它,那么他就会知道所需的数据是在查询字符串/会话变量中。



注意:某些第三方银行支付网关也使用相同的技巧。他们调用我们网站的网页,并指定可以从查询字符串/会话变量中提取所需的信息。



希望我帮助。


HI,

I have a method in ASP.net web page,it returns thw string parameter.from the Web service method how can i access that web page method using HTTP request.

解决方案

@rahul

Actual flow is

Request: ClassLibrary ------> Webservice --------> web page
responce: webpage------->webservice------->classlibrary

in the above flow webservice takes the input from class library and adds data to input and sent it to web page,then web page responds back with respective string value of given amended input to web service,then web service returns it to the class library.


Request: ClassLibrary ------> Webservice --------> web page
responce: webpage------->webservice------->classlibrary

TO Achieve this, I think the best way would be to do a response.redirect to the webpage. Whatever data you want to pass to the web page can be passed in query string if it is small and trivial or it can be put in session variable if the data is long and sensitive.

so the webservice could simply do a response.redirect or server.transfer after putting the required data in querystring or session veriable and the web page can fetch the data on rendering itself.

This way you are also decoupling the webservice and keeping the notion intact. If tomorrow some java or php guy need to use it then he will know that the required data is coming in querystring/session variable.

NOTE: Some of the 3rd party bank payment gateways also use the same trick. they call the web page of our site and specify that the required info can be pulled from querystring/session variable.

Hope I helped.


这篇关于如何使用HTTP请求从asp.net Web服务访问ASP.net网页方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆