A popup notification balloon after comment reply in asp.net - c#

Now I am doing a forum like website. I wan to do something like after the member reply the post and the homepage will display a popup notification balloon and show out the number of notification that the member are unread. May I know how can I make it? I am using asp.net and C# in my website.

You can use the PopupControl in AJAX:
<ajaxToolkit:PopupControlExtender ID="PopEx" runat="server"
TargetControlID="DateTextBox"
PopupControlID="Panel1"
Position="Bottom" />
Here is a link that explains it further.
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/PopupControl/PopupControl.aspx

It sounds like you need to enable communication across browser sessions. For something like this I'd suggest SignalR http://www.asp.net/signalr.
It allows you to use javascript to broadcast messages and listen for messages sent from the server. You can also hook into it via code behind. So, say user X responds to user Y's post. After you do what you need to do to save the post to the database, you add a bit of code that broadcasts to user X "Hey! Someone commented on your post. Check it out!".

Related

Firing hCaptcha callback function for bypass token

I'm trying to bypass the hCaptcha in Discord Account Registration using selenium webDriver in C#. I'm using CapMonster Cloud API for solving the captcha itself and as response I'm getting bypass token.
The problem that I currently have is that I can't locate the callback function that I need to call/submit, in order to pass the hCaptcha.
I'm setting the bypass token into "g-recaptcha-response" and "h-captcha-response" textareas, but can't find a way to locate and call the callback function. There is no form to be submitted.
using selenium webDriver in C#
10/10 Would recommend doing discord captcha bypasses using:
PuppeteerExtraSharp/ExtraStealth
(as selenium has some obvious tracers)
Puppeteer has a lot more freedom in it's API as well as the fact that 2capthca is a much more popular method for solving h-captchas
I know this doesn't answer your question but i hope you look into this as a potential better alternative if you do not receive a more traditional answer.
You can do that with Anti-Captcha.com plugin which will do the job automatically. It injects its own callbacks, so when a token is ready it submits the form. If you ever have problems with plugin, support guys here will help you out.
Web communication has to happen in one of the methods defined on this page
So if anything is being sent and received from a server to the browser it has to be one among those methods. Generally the most common methods are POST and GET.
The statement "There is no form to be submitted" is somewhat confusing. A form is just display of fields to collect data from a user. In case a website does not need user input they do not show the form. They would instead capture the required data and send a POST request to the server (without the user ever noticing), in a manner similar to how a form would have sent the data. This is a normal behavior for almost all major websites. An example is google-analytics codes.
So what you need to look for is a POST request (mostly or PUT maybe GET - depends) where the data you are targeting is received or sent.
In your case there indeed is a form which displays the captcha (that is how you see it) and and associated POST request which does what you need.
Url for the post request on the captcha is POST /getcaptcha?s=xxxxxxxx-xxxe-xxxx-xxxx-xxxxxxxxxxxx HTTP/3
Url where it is sent is POST /api/v9/auth/register HTTP/3
These basics apply to any web communication and not just the website in question.

Are there a way to receive and handle http request in .NET UWP Apps?

I've a UWP App, with a MainPage that displays a radio button emulating a lamp (true = on, false = off).
I need to expose this property and interact with it, with http requests.
Specifically, from the client I'll call the server running the app, with some things in query string, like 192.168.1.1/?on.
When the app receives the request, it will do something like turn on the lamp (set radiobutton to true), and show this in real time in the UI.
Is it possible?
I've tried some libraries like Restup, but I think they are specific for sending requests, not to receive.
There is no built-in functionality for an HTTP server in UWP... but you might not need that. Based on your requirement, you can make-do with opening a socket and listening for incoming connection/data on that socket.
You can take a look at the documentation describing that functionality here
This is exactly why Restup was build, take a look at the one-pager to get you going. Controlling your lamp will be pretty easy.
Note: I'm the author of Restup

Click "Send" button of G-Mail programmatically

I am creating an Email Sending Software. So far i am able to open chrome and fill the details of the email (subject,body,attachments and all) but i wanted to know is there any way i can click Send button of G-Mail programmatically too?
Code for filling details in chrome
Process ps = Process.Start("chrome.exe", "https://mail.google.com/mail/u/0/?view=cm&fs=1&tf=1&to=a#gmail.com&bcc=b#gmail.com);
Note I haven't used SmtpClient to send email because it was not fulfilling my customized requirement (sorry cannot disclose the reason).
The way you want this, is not possible. Process.Start opens a new Process. In this case it opens Google Chrome, with the URL you sent with it. This URL contains a querystring containing the subject and the body of the email. This is possible, because Google reads this on the server-side, and puts it in the right fields. There is no way to enter the send button though. This is a POST action, which can not be triggered by a URL.
C# form, does have a WebBrowser class. From here you can access buttons and click them, but I don't think Google will allow this, and most likely send you a captcha. (That is, if you manage to login in the first place.)
I can't help with the simulated button press you're looking for, but I can suggest that you rather try to use the Gmail API to do what you're trying to do:
https://developers.google.com/gmail/api/?hl=en
This would be a more reliable and stable way to send gmail programmatically, and you still don't have to use the smtp object directly.
You should probably use Selenium (WebDriver). It allows you to control browser from c# code, navigates pages, traversing DOM etc..

Post to Facebook WP8 C#

So I used this example
http://facebooksdk.net/docs/phone/howtos/publish-to-feed/
And when I tap the button I made, it shares a preset link. How do I change it to a textbox i have in the app?
And I use this code:
App.RootFrame.Navigate(new Uri("/MainPage.xaml", UriKind.RelativeOrAbsolute));
To redirect back to the mainpage after posting a message on facebook. but if i tap the back button, it goes back to the previous page i used to post a message. how do I fix it?
You might be better using the phones built in share api. That way the user can share with any social network they've connected to on their phone.
http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394009(v=vs.105).aspx
If you do need to do it the way you have then it sounds like you want to intercept the back button event.
http://msdn.microsoft.com/en-us/library/windowsphone/develop/microsoft.phone.controls.phoneapplicationpage.backkeypress(v=vs.105).aspx
You could change the navigation stack with NavigationService.RemoveBackEntry(); after you have navigated away from the posting page.
Perhaps it is possible to run RemoveBackEntry() on the on posting pages OnNavigatedFrom event.

How to show RSS as pop-up?

On my website users can post comments on a document. Now I want to send an RSS feed to the webmasters when a comment is posted. I want the webmaster to be notified by a small pop-up in the right corner of the page. So this is what's happening:
User adds comment
system checks if webmaster is logged in
if webmaster is logged in; show pop-up in right corner with the title of the comment in it.
How to accomplish this?
Setup a javascript timer to call a webservice periodically (every 5 seconds?) if the user is a webmaster. This webservice can determine if a new comment has been added since the last time it was checked. The webservice returns nothing if no new comment or some information about the comment if there is a new one.
If the webservice returns a comment, put that information into a div tag that you have created on your page and make it visible. If you are sure the webmaster is using a modern browser, you can use position:fixed to put this div tag in the upper right corner. If not, you will have to use some javascript to accomplish this.
Unless you're using a comet style service to push notifictaions to the webmaster's browser, you're going to need to make a page that polls for new notifications at a pre-defined interval. You can then make an AJAX call to the service and parse the response on to a web page that only the webmaster has access to.
If you're interested in comet (services that can push data to the connected client), you can get a start at Wikipedia:
Comet (programming)

Categories

Resources