converting facebook javascript sdk variables into asp variables? - javascript

I have a facebook sign up and login button build using js sdk. I want to store user response into a database, but I cant get the userID or User.email with classic asp.
Sometimes it works, sometimes not, can't find pattern.
var email=response.email;
var fbid=response.id;
var fbname=response.name;
var fbbirthday=response.birthday;
var fbhometown=response.hometown.name;
document.getElementById('fbmail').value = email;
document.getElementById('fbid').value = fbid;
document.getElementById('fbname').value = fbname;
document.getElementById('fbbirthday').value = fbbirthday;
document.getElementById('fbhometown').value = fbhometown;

You can use classic ASP to get all of that information server-side. You would need to build your own framework to wrap up the HTTP Get/Post/Delete commands to the Graph API. But to accomplish getting that basic user information should be fairly straight forward once you have nice wrappers around those three HTTP verbs.
A quickie solution would be to FORM post those values back to the server. I assume you have https, so security shouldn't be an issue.

Related

Login .Net Identiy User Using Jwt NodeJs Api

Converting .Net api into Node.js, now I need to login user using Identity table using...
var user = _userManager.FindByNameAsync(userDto.Username).Result;
var result = await _userManager.CheckPasswordAsync(user, userDto.Password);
One option is to use plain query but it does not seem like a feasible solution.
Please kindly let me know what should I do?

Downloading a site's content and displaying (part of) it in another site

I want to make a program that logs into some sites, say Gmail, some news site, etc. Make it download some of the content (important emails, for example), and show it in some site I make.
Can this be done with Java? If not, is there any 'simple' way to do this with JavaScript (I'm just a noobie at it)?
Thanks.
There is! Try this:
Properties properties = new Properties();
properties.put("mail.store.protocol", "imaps");
properties.put("mail.imaps.host", "imap.gmail.com");
properties.put("mail.imaps.port", "993");
properties.put("mail.imaps.timeout", "10000");
Session session = Session.getInstance(properties);
IMAPStore store = null;
Folder inbox = null;
try {
store = (IMAPStore) session.getStore("imaps");
store.connect(username, password);
...
This connects to gmail using IMAP.
If you want to know more, this question is great: Right way to display mail from Gmail

json refresh no ajax ,websockets

I want to get the data from here
https://btc-e.com/api/3/ticker/btc_usd
in php i use :
$jsonbtce = file_get_contents('https://btc-e.com/api/3/ticker/btc_usd');
$decodedbtce = json_decode($jsonbtce);
$lastprice = $decodedbtce->btc_usd->last;
then i use jquery ajax to refresh the data
var updateInterval = setInterval(function() {
$('.mydivclass').load('btce.php');
},3*1000);
How can i use websockets with jquery or javascript to get the data from that url ? so i can use the $lastprice for other stuff even if price updates,using ajax not good.
I'm facing the same problem as you. I'm sorry to say that you will need to set up a WebSocket server (written in PHP or Java, for example) and configure it. Take a look at Ratchet ws server, node.js webSocket servers or search through GitHub for a webSocket server.
This is the info I have.
I will be glad if someone posts a more specific answer.
This looks very nice, if you know Java.

What is with the Dreamcode idea?

The Dreamcode as described here: http://nobackend.org/dreamcode.html
That developers don't have to worry about the backend when developing web applications.
Is very interesting. However I have few question on building application logic in the front-end.
The question is, even with authentication being processed in the backend.
What are the ways to make the app logic obfuscated and not to be copied easily?
For the application models it is easy for a server to receive it. However looking with the Store and Public Store idea from Dreamcode, how can we handle fields that are not meant to be sent back to the front-end for security purposes?
For example in this Gist it show how to get object by id:
// find one object
var type = 'note';
var id = 'abc4567';
store.find(type, id)
.done(function (object) {});
The issue here is, for example I have an application that guest user can post a document and edit it later with a password. A guest user saves a document with a encrypted password in it.
When other users "views" the document from the front-end application. The Dreamcode data store will return all the fields for this document object (based on the Dreamcode specification) including the encrypted password, which is not good.
So how can we deal with making a Front-end application with Dreamcode with these potential limitations?

Save Email Addresses on Website

I have created a simple website and have a form that asks the user to input their email address to receive future updates from me.
What is the best way to save these emails. I am not anticipating having many so initially thought I could email them to myself every time someone submits theirs. I know how to do this using ASP.Net and Gmail. My questions then are:
1) Is there a way to accomplish this using just html and JavaScript and would this be better than having to use ASP.Net just for this one thing on my site (I haven't looked much into web hosting but I would have thought it would be cheaper to use just html and JavaScript)?
2) Is there a much better way to go about this that I have missed?
Thanks
Rob
Is there a way to accomplish this using just html and JavaScript
No
Is there a much better way to go about this that I have missed?
Use real mailing list software or a third party mailing list service. This will save you from having to maintain the list manually (which is error prone) and (especially if you use a decent third party service) reduce the number of indicators that your emails are likely to trigger in spam filters.
As Quentin mentioned you can't do this solely with HTML and JavaScript. You can either implement this youself (with ASP.net) or use a third party mailing service, which is the better option.
I recommend having a look at mailchimp as they provide an excellent free service and you have the option of embedding a subscription widget on your website or you can always use their API to manage that yourself.
You can't do it with just HTML and JavaScript - the reason is that the data entered is on the client side (i.e. on the user's browser), and you can't ask the user's browser to send you an email. You'd need to have the email submission send the data to your server or a third party server, which can then do what you want with the data.
you should use one of server side Languages i recommend Asp.net you can use This
SmtpClient client = new SmtpClient(mailsmtp);
client.Credentials = new NetworkCredential(mailto, mailpass);
string to = mailto;
MailMessage mail = new MailMessage();
mail.From = new MailAddress(mailto, "Form name");
mail.To.Add(to);
mail.Body = lbl_message.Text + " " + lbl_name.Text + " " + lbl_mail.Text;
mail.Subject = "subj";
client.EnableSsl = true;
client.Port = 587;
mail.IsBodyHtml = true;
client.Send(mail);
Use something like Mailchimp it's very easy to add the sign up box to your site and it's free forever if you have less than 2000 subscribers and send less than 12000 mails per month. It also provides the facility to send great looking emails... If you implement your own system you'd need a way to send the mails, and your ISP may well prevent you mass mailing from your normal email account.

Categories