Answered by:
Get page contents from handler

Question
-
User1510859543 posted
We are using an http webhandler to get querystrings, etc. from a SMS text vendor as noted in code sample below. Is it possible to grab the page content as well? If so, how?
<%@ WebHandler Language="VB" Class="SMSReplyHandler" %> Imports System Imports System.Web Imports System.Net Imports System.Net.Mail Imports System.Data.SqlClient Public Class SMSReplyHandler : Implements IHttpHandler Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest context.Response.ContentType = "text/plain" Dim strMOMessageID As String = "" Dim strapiID As String = "" If Not context.Request.QueryString("api_id") Is Nothing Then strapiID = context.Request.QueryString("api_id") End If If Not context.Request.QueryString("from") Is Nothing Then strFromQS = context.Request.QueryString("from") End If If Not context.Request.QueryString("text") Is Nothing Then strTextQS = context.Request.QueryString("text") strBody = "Message reply = " & strTextQS End If <remainder of code> End Sub Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable Get Return False End Get End Property End Class
Monday, January 7, 2019 9:21 PM
Answers
-
User475983607 posted
Your question is very confusing.... You already have the request object.
context.Request
And you have control of the response.
context.Response
If you are asking for access to the third party response to the client request, no you do not have access unless you own the 3rd party software. If you do own the software then you already have access to the Request and Response.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, January 8, 2019 2:42 PM
All replies
-
User283571144 posted
Hi dlchase,
Is it possible to grab the page content as well? If so, how?What you mean about grab the page content?
Do you mean you want to grab send page's content?
Could you please tell me how you call this handler?By ajax or something else?
If you could post more details information, it will be more easily for us to understand your issue and find out the solution.
Best Regards,
Brando
Tuesday, January 8, 2019 12:49 PM -
User1510859543 posted
Yes, I want to grab the sending content from the 3rd party. We have setup at the 3rd party a URL to our website e.g. "ourweb.com/misc/ReplySMS.aspx". Below is what we have in web.config inside system.web section to route that request to the handler.
<urlMappings enabled="true"> <add url="~/misc/ReplySMS.aspx" mappedUrl="~/SMSReplyHandler.ashx" /> </urlMappings>
Tuesday, January 8, 2019 2:24 PM -
User475983607 posted
Your question is very confusing.... You already have the request object.
context.Request
And you have control of the response.
context.Response
If you are asking for access to the third party response to the client request, no you do not have access unless you own the 3rd party software. If you do own the software then you already have access to the Request and Response.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Tuesday, January 8, 2019 2:42 PM