简体   繁体   中英

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. 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 (:).

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
  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
  3. You can use a POST reqest with data

You Url is wrongly formed and you have included special character in your redirect URL. That why you received A potentially dangerous Request.Path value was detected from the client (:) exception.

Below is how URL are formed with querystring.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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