Posts

Send simple notification to Android

Send  simple notification to Android    public string SendNotification( string DeviceToken, string message)         {             var value = message;             WebRequest tRequest;             tRequest = WebRequest .Create( "https://android.googleapis.com/gcm/send" );             tRequest.Method = "post" ;             tRequest.ContentType = " application/x-www-form-urlencoded;charset=UTF-8" ;             tRequest.Headers.Add( string .Format( "Authorization: key={0}" , Common .GoogleAppID));             tRequest.Headers.Add( string .Format( "Sender: id={0}" , Common .SENDER_ID));             string postData = "collapse_key=score_update&time_to_live=108&delay_while_idle=0&data.message=" + value + "&data.time=" + System. DateTime .Now.ToString() + "&registration_id=" + DeviceToken + "" ;             Console .WriteLine(postData);  

Post Data on URL using Asp.net C#

Post Data on URL using Asp.net C C# code : private void PostForm()         {             string remoteUrl = "Posted_Url" ;             string MobileNo = "11" ;             string EmailId = "11" ;             string Registrationno = "11" ;             string PackageName = "11" ;             string ExpiryDate = "1-12-2017" ;             string TransactionId = "11" ;              string memberCode = "11" ;             string CoverageDetails = "11" ;             string Status = "11" ;             string PartnerName = "11" ;             HttpWebRequest request = ( HttpWebRequest ) WebRequest .Create(remoteUrl);             request.Method = "POST" ;             request.ContentType = "application/x-www-form-urlencoded" ;             string postData = string .Format( "MobileNo={0}&EmailId={1}&Re

Send Fire base notification to Android using Asp.net C#

Send Fire base notification to Android using Asp.net C# C# Code : public String SendNotificationFromFirebaseCloud( string DeviceToken, string Content)         {             string YOUR_FIREBASE_SERVER_KEY = "Please_put_server_key_Here" ;             var result = "-1" ;             var webAddr = "https://fcm.googleapis.com/fcm/send" ;             var httpWebRequest = ( HttpWebRequest ) WebRequest .Create(webAddr);             httpWebRequest.ContentType = "application/json" ;             httpWebRequest.Headers.Add( "Authorization:key=" + YOUR_FIREBASE_SERVER_KEY);             httpWebRequest.Method = "POST" ;             using ( var streamWriter = new StreamWriter (httpWebRequest.GetRequestStream()))             {                 // string json = "{\"to\":\"c6olDNPubCw:APA91bFbaqwHFHTcnny_PHXRBnAQ7w0ajkedasNaaowP858qXUUzO3X13MSR07A0Uuj721S5TpT_k7UOkMYl0UosV5E_1H

Post data and Redirect on URL in Asp.net

Post data and Redirect  on URL in Asp.net C# Code:      NameValueCollection data = new NameValueCollection ();             data.Add( "UserName" , "val1" );             data.Add( "MobileNo" , "val2" );             HttpHelper .RedirectAndPOST( this .Page, "http://mobileapp.co.in:8000/website/responsive" , data);

Get Real Time Distance and ETA in asp.net using Google API

 Get Real Time Distance and ETA in asp.net using Google API C# Code : public   bool  Getdistance()         {              string  result =  "" ;              WebRequest  request =  null ;              HttpWebResponse  response =  null ;                          String  url =  "https://maps.googleapis.com/maps/api/directions/xml?origin=28.668186,77.2301363&destination=28.603156,77.1773745" ;             request =  WebRequest .Create(url);             response = ( HttpWebResponse )request.GetResponse();              Stream  stream = response.GetResponseStream();              Encoding  ec = System.Text. Encoding .GetEncoding( "utf-8" );              StreamReader  reader =  new             System.IO. StreamReader (stream, ec);             result = reader.ReadToEnd();              XmlDocument  xml =  new   XmlDocument ();             xml.LoadXml(result);   // suppose that str string contains "<Na

Remove First and last comma from string in SQl

Remove First and last comma from string in SQl   declare @Str nvarchar ( max )= ',kandy,'   if (right( rtrim ( @Str ), 1 ) = ',' ) begin          set @Str = substring ( rtrim ( @Str ), 1 , len ( rtrim ( @Str ))- 1 )   end if (left( ltrim ( @Str ), 1 ) = ',' ) begin        set @Str = Substring ( @Str , 2 , ( len ( @Str ))) end select @Str

Replace Enter key from string in Sql

Replace Enter key from string  in Sql declare @C nvarchar ( max ) set @C = 'kandy deol' select @C as WithEnterKey select REPLACE ( REPLACE ( @C , CHAR ( 13 ), '' ), CHAR ( 10 ), '' ) as WithOutEnterKey