Posts tagged with asp.net-mvc

I haven't found any examples for using FacebookClient to upload photos to a Facebook page in C#. I tried using the JavaScript SDK, but it exposes a lot of functionality I don't need. I'm implementing the upload functionality with FacebookClient in my custom Facebook service.

I'm encountering issues, and the photo needs to be under 4 MB and in JPG, PNG, GIF, TIFF, or HEIF format. Can anyone provide guidance or examples for this specific scenario?

I'm working on an ASP.NET MVC app using SignalR that implements a WhatsApp Chat, where the user can send a message from the app to a WhatsApp number, and from there it can be answered, thus showing the response on the page. So far, I've got to separate the messages sent from the WhatsApp account to each tab on different browsers, as I'm using the SignalR connectionID, given that each time a page is loaded, a new connection is established.

From the client, I send the messages as follows

connection.invoke("SendMessage", user, message).catch(function (err) {     return console.error(err.toString()); }); 

and from the server, I send the message to all clients as follows

public async Task SendMessage(string user, string message) {     await Clients.All.SendAsync("ReceiveMessage", user, message); } 

To a particular client, I send a message with the connectionID

await _hubContext.Clients.Client(idConexion).SendAsync("ReceiveMessage", "Message:", textMessage[0].Text.Body);

What I'd like is that the same browser is considered as only one connection, no matter how many tabs are opened. I know from the documentation and other StackOverflow questions that each tab opened is a different connection, but I just need to broadcast the same message to all active tabs of a browser. My current logic is that messages are sent to a particular connection, using the unique WAMID from each message from the WhatsApp Business API.

I'm trying to implement whatsapp business API but I'm getting forbidden error I think its because i dont have enough permission. I have also implemented this code on Postman its works fine there but its not working in app i dont know why?

var client = new HttpClient();         var request = new HttpRequestMessage(HttpMethod.Post, "https://graph.facebook.com/v15.0/110474688636083/messages");         request.Headers.Add("Authorization", "Bearer EAAM2wERIcIsBAFSGQD3yCSYRd5II5u7hU1859z8VcpNFlZBjJrqJUR2QrgZADHlHYSCG0zWvpYqVkFlzea9TsN1wnu8ZBZBSiEaXQu5OZAQC63ufVKZAQDHZB25CIq3TBQ9rxr2DdZB1oZBgJtia4eAEBbzqfjwJpXm9M5SZCGhDh7JbK0s1ldz2Od099jHfKrFvnQDZD");         var content = new StringContent("{\n    \"messaging_product\": \"whatsapp\",\n    \"to\": \""+WHATSAPPNO+"\",\n    \"type\": \"template\",\n    \"template\": {\n        \"name\": \"hello_world\",\n        \"language\": {\n            \"code\": \"en_US\"\n        }\n    }\n}", null, "application/json");         request.Content = content;         var response = await client.SendAsync(request);         response.EnsureSuccessStatusCode();         Console.WriteLine(await response.Content.ReadAsStringAsync()); 

thank you for your time

I am using Google Ads to track purchase conversions on my Ecommerce website. When a user clicks on my Google Ad for a product and then makes the purchase and lands on the thank you page, the conversion event is triggered and sends google the data so that it knows that an order has been placed and it can track the conversion.

My problem is that EACH time that same thank-you page is loaded with that users order id token, it fires that script and Google tracks that as another conversion. This should only be happening once, this should only happen the first time the page is accessed with that order token.

Take this url below for example. A user saw my Google Ad and then clicked on it and purchased and then he landed on the thank you page. At this point it was tracked as a conversion. https ://mywebsite.com/purchase/thank-you/order/1001632bfd1c-2x5a-701t-1xs90a0a4444

Sometime later the same day or 20 days later, the user opens up the browser on his phone and that page reloads, or the user wants to check his browsing history and clicks on this url. As soon as he lands on it, the script will fire once again and count that as a conversion for the ad he originally clicked on.

Is there a way that I can make it so that the script only fires the first time a url loads? Merchants who are using Shopify simply wrap the conversion event script with {% If First_time_accessed %} in Liquid which is Shopify's language. This makes it so that even if the user reloads that same url, the script won't fire again to track that page visit as another conversion.

How do I do this type of logic if I am developing my site in ASP.net using C# MVC ? Is there some javascript I can wrap my event snippet with to make it work like Shopify does it? I have searched for this but keep only finding info on how to do it on Shopify. Note...I am not using Tag Manager, I want to just leave the event snippet on my page without having to set up anything in tag manager.

Here is my script currently:

<!-- Global site tag (gtag.js) - Google Analytics -->   <script async src="https://www.googletagmanager.com/gtag/js?id=G-M3WT222222"></script> <script>     window.dataLayer = window.dataLayer || [];     function gtag() { dataLayer.push(arguments); }     gtag('js', new Date());     //conversion tracking for Google Analytics     gtag('config', 'G-M3WT222222');     //conversion tracking from Google Ads     gtag('config', 'AW-12057888501'); </script> <!-- Event snippet for MYwebsite Purchase conversion page --> <script>         gtag('event', 'conversion', {             'send_to': 'AW-12057888501/x0QzZp_vliJUHNC-B08Zx',             'value': @ViewBag.Display_subtotal,             'currency': '@ViewBag.Display_currencyAbbreviation',             'transaction_id': '@ViewBag.Display_invoiceNumber'         }); </script> 

This is an example of how Shopify does this. Notice the code is wrapped in some liquid code shown here {% if first_time_accessed %}

{% if first_time_accessed %} <!-- Event snippet for Purchases Shopify conversion page --> <script>   gtag('event', 'conversion', {   'send_to': 'AW-2035565011/frthgrt455_151f5rfc',   'transaction_id': '{{ order_number  }}'   }); </script> {% endif %}