Hi,
I have a problem, and I dont now how to resolve. Please halp. I use ASP.NET 2.0.
I need to submit this from my code, and user dont aloud to see this:
When I do this from my localhost with this code:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
' Create a request using a URL that can receive a post.
Dim request As WebRequest = WebRequest.Create("
' Set the Method property of the request to POST.
request.Method = "POST"
' Create POST data and convert it to a byte array.
Dim postData As String = "account=" & Server.UrlEncode("acca_test") & "&password=" & Server.UrlEncode("test_pass") & "&mobile=" & Server.UrlEncode("5454451225") & "&sender=" & Server.UrlEncode("dmpa") & "&text=" & Server.UrlEncode("message_test_message")
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)
' Set the ContentType property of the WebRequest.
request.ContentType = "application/x-
' Set the ContentLength property of the WebRequest.
request.ContentLength = byteArray.Length
' Get the request stream.
Dim dataStream As Stream = request.GetRequestStream()
' Write the data to the request stream.
dataStream.Write(byteArray, 0, byteArray.Length)
' Close the Stream object.
dataStream.Close()
' Get the response.
Dim response As WebResponse = request.GetResponse()
' Display the status.
' Get the stream containing content returned by the server.
dataStream = response.GetResponseStream()
' Open the stream using a StreamReader for easy access.
Dim reader As New StreamReader(dataStream)
' Read the content.
Dim responseFromServer As String = reader.ReadToEnd()
' Display the content.
TextBox1.Text = responseFromServer
' Clean up the streams.
reader.Close()
dataStream.Close()
response.Close()
End Sub
Everything works fine.
I got response from there server:
<?xml version="1.0"?>
<report>
<status>error</status>
<error_code>7</error_code>
<error_desc>Access denied.</error_desc>
</report>
Because my local IP address is not in there system.
But when I upload my aplication on my server. I am not get any response message, I got an error page:
Server Error in '/' Application.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
What is wrong with my code? Help me please...
I have a problem, and I dont now how to resolve. Please halp. I use ASP.NET 2.0.
I need to submit this from my code, and user dont aloud to see this:
When I do this from my localhost with this code:
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
' Create a request using a URL that can receive a post.
Dim request As WebRequest = WebRequest.Create("
' Set the Method property of the request to POST.
request.Method = "POST"
' Create POST data and convert it to a byte array.
Dim postData As String = "account=" & Server.UrlEncode("acca_test") & "&password=" & Server.UrlEncode("test_pass") & "&mobile=" & Server.UrlEncode("5454451225") & "&sender=" & Server.UrlEncode("dmpa") & "&text=" & Server.UrlEncode("message_test_message")
Dim byteArray As Byte() = Encoding.UTF8.GetBytes(postData)
' Set the ContentType property of the WebRequest.
request.ContentType = "application/x-
' Set the ContentLength property of the WebRequest.
request.ContentLength = byteArray.Length
' Get the request stream.
Dim dataStream As Stream = request.GetRequestStream()
' Write the data to the request stream.
dataStream.Write(byteArray, 0, byteArray.Length)
' Close the Stream object.
dataStream.Close()
' Get the response.
Dim response As WebResponse = request.GetResponse()
' Display the status.
' Get the stream containing content returned by the server.
dataStream = response.GetResponseStream()
' Open the stream using a StreamReader for easy access.
Dim reader As New StreamReader(dataStream)
' Read the content.
Dim responseFromServer As String = reader.ReadToEnd()
' Display the content.
TextBox1.Text = responseFromServer
' Clean up the streams.
reader.Close()
dataStream.Close()
response.Close()
End Sub
Everything works fine.
I got response from there server:
<?xml version="1.0"?>
<report>
<status>error</status>
<error_code>7</error_code>
<error_desc>Access denied.</error_desc>
</report>
Because my local IP address is not in there system.
But when I upload my aplication on my server. I am not get any response message, I got an error page:
Server Error in '/' Application.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
What is wrong with my code? Help me please...