public static string Getmobileconfbyuserid (string userid)
{
String rs = null;
if (!string. IsNullOrEmpty (userid))
{
if (string. IsNullOrEmpty (Stronline))
{
Stronline = configurationmanager.appsettings["Onlineurl"];
}
Servicepointmanager.defaultconnectionlimit = 300;
System.GC.Collect ();
Cookiecontainer Cookiecontainer = new Cookiecontainer ();
Set up related parameters for submission
HttpWebRequest request = null;
HttpWebResponse sendsmsresponse = null;
Stream dataStream = null;
StreamReader sendsmsresponsestream = null;
Try
{
Request = WebRequest.Create (stronline) as HttpWebRequest;
Request. method = "POST";
Request. KeepAlive = false;
Request. Servicepoint.connectionlimit = 300;
Request. AllowAutoRedirect = true;
Request. Timeout = 10000;
Request. Readwritetimeout = 10000;
Request. ContentType = "Application/json";
Request. Accept = "Application/xml";
Request. Headers.add ("X-auth-token", Httputility.urlencode ("OpenStack"));
String strcontent = "{\ appid\": \ "\", \ "method\": \ "\" \ "tokenid\": \ "\", \ "data\": {\ "useraccountid\": \ "" + userid + "\"} }";
byte[] bytes = Encoding.UTF8.GetBytes (strcontent);
Request. Proxy = null;
Request. Cookiecontainer = Cookiecontainer;
using (DataStream = Request. GetRequestStream ())
{
Datastream.write (bytes, 0, bytes. Length);
}
Sendsmsresponse = (httpwebresponse) request. GetResponse ();
if (Sendsmsresponse.statuscode = = httpstatuscode.requesttimeout)
{
if (sendsmsresponse!= null)
{
Sendsmsresponse.close ();
Sendsmsresponse = null;
}
if (Request!= null)
{
Request. Abort ();
}
return null;
}
Sendsmsresponsestream = new StreamReader (Sendsmsresponse.getresponsestream (), encoding.getencoding ("Utf-8"));
String strrespone = Sendsmsresponsestream.readtoend ();
return strrespone;
}
catch (Exception ex)
{
if (DataStream!= null)
{
Datastream.close ();
Datastream.dispose ();
DataStream = null;
}
if (Sendsmsresponsestream!= null)
{
Sendsmsresponsestream.close ();
Sendsmsresponsestream.dispose ();
Sendsmsresponsestream = null;
}
if (sendsmsresponse!= null)
{
Sendsmsresponse.close ();
Sendsmsresponse = null;
}
if (Request!= null)
{
Request. Abort ();
}
}
Finally
{
if (DataStream!= null)
{
Datastream.close ();
Datastream.dispose ();
DataStream = null;
}
if (Sendsmsresponsestream!= null)
{
Sendsmsresponsestream.close ();
Sendsmsresponsestream.dispose ();
Sendsmsresponsestream = null;
}
if (sendsmsresponse!= null)
{
Sendsmsresponse.close ();
Sendsmsresponse = null;
}
if (Request!= null)
{
Request. Abort ();
}
}
}
Return RS;
}