I would like the server to call the URL (ashx page) programmatically and save the response as a string. Using HttpWebRequest does not seem to work properly, because I do not want to redirect the client there.
Thanks.
If you want to call another page and return the response as a string, you can use a class WebClient.
WebClient
var myWebClient = new WebClient(); string resultStr = myWebClient.DownloadString("http://www.google.com");
First, you need to determine what you mean by “calling”:
Should the user's browser go to a specific URL? use Response.Redirect ()
ASP.Net URL-? iframe
, URL- ? WebRequest.Create(), , IIS .
, HttpWebRequest "" . ?
ashx Response.Redirect:
System.Web.HttpContext.Current.Response.Redirect("http://www.stackoverflow.com/");
System.Web.HttpContext.Current.Server.Transfer("a path to a page on the same server");
:
. HttpWebRequest WebClient.
Response.Redirect( "SomeURL" );
You can use a socket. But that sounds crazy. You can use the XMLHttpRequest object, you know MSXML2.XMLHttpRequest, but this is crazy again. What do you mean by the "does not send byte information" part ...
Source: https://habr.com/ru/post/1715649/More articles:Как я могу решить проблемы с "всемирной записью" с модулями, загруженными в PAUSE (CPAN) из Win32? - perlАвтоматизация развертывания JBoss в Eclipse? - eclipseLimit Java maven plugin configuration options - javaASP.NET allows you to bind to code - javascriptaccess time for small array versus small structure in C # - arraysShould web pages look the same across browsers? - designoracle xml parsing gives invalid character error - xmlruby on rails redirect_to (: back) does not work - redirectTeam Planning Algorithm - Quiz Design - C #OO JS and Google Maps APIs: What am I doing wrong? - javascriptAll Articles