HTTP-GET Request cross-domain - Security issue
Hej!Jeg skal sende en get forespørgsel til et andet domæne end, der hvor min løsning ligger.
Jeg har følgende kode:
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using System.Net;
using System.IO;
using System.Security.Permissions;
namespace SMS_gateway
{
[AspNetHostingPermission(SecurityAction.Demand, Level = AspNetHostingPermissionLevel.High)]
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
try
{
WebRequest req = WebRequest.Create("http://int.etdomae.ne/somewhere/?msg=Test&rec=xxxxxxxxxx&sapid=xxxx&password=xxxxxxxx");
req.Credentials = CredentialCache.DefaultNetworkCredentials;
HttpWebResponse response = (HttpWebResponse)req.GetResponse();
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
reader.Close();
dataStream.Close();
response.Close();
resulttxt.Text = responseFromServer;
}catch(Exception ex){
resulttxt.Text = ex.StackTrace;
}
}
}
}
Hvordan knækker jeg lige den?