简体   繁体   English

如何在两个项目ASP.NET之间传递参数

[英]How to pass parameter between two project asp.net

I have C# page to send parameters to an webservice and the webservice is not in the same project. 我有C#页可以将参数发送到Web服务,并且该Web服务不在同一项目中。 I know the url of the webservice. 我知道网络服务的网址。 How can I pass the parameters, I've tried the code below 我如何传递参数,我已经尝试过下面的代码

 Response.Redirect(" http://url/mobileservice.asmx/kioskOyunKodu?kioskkod='+kioskID+',kioskKodEncryped='+encodedCode+',okulno='+txt_StudentID.Text'");

Is there any other way to solve this issue when I execute that line I got 当我执行该行时,还有其他方法可以解决此问题吗

A potentially dangerous Request.Path value was detected from the client (:). 从客户端(:)检测到潜在的危险Request.Path值。

There is a space for creativity for this particular case: 在这种特殊情况下,有创造力的空间:

  1. Change your site security policies that let you pass parameters with special characters with you GET request 更改站点安全策略,以使您可以在GET请求中传递带有特殊字符的参数
  2. in case if your both project have an access to a shared resouce like database, you can push all the bunch of parameters in a single table with uniqie ID and then you can pass the id as a parameter between your service url 如果您的两个项目都可以访问共享资源(如数据库),则可以将所有参数组合推送到具有唯一ID的单个表中,然后可以在服务URL之间将ID作为参数传递
  3. You can use a POST reqest with data 您可以对数据使用POST请求

You Url is wrongly formed and you have included special character in your redirect URL. 您的网址格式错误,并且您在重定向URL中包含特殊字符。 That why you received A potentially dangerous Request.Path value was detected from the client (:) exception. 这就是为什么从客户端(:)异常中检测到潜在危险的Request.Path值的原因。

Below is how URL are formed with querystring. 以下是如何使用querystring构成URL。

Response.Redirect("http://url/mobileservice.asmx/kioskOyunKodu?kioskkod="+ kioskID + "&kioskKodEncryped=" + encodedCode + "&okulno=" + txt_StudentID.Text); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM