vb.net sending datagridview content to client side - vb.net

I'm creating a chat system for my company and what i have now is a functional chat with (on the server) a list that contains all logged in users and their nickname.
What i want to do is to send this datagridview to every client when a new employee enters the chat.
How can i do this?
i tried to convert my gridview into a dataset.writexml but that doesn't work.
the only thing i use now are some commands to send the messages:
Send("#MSG#Hello everyone")
Send("#LOGIN# #1#Username#2#Employeename")
Send("#LOGOUT# #1#Username#2#Employeename")
...
I'm using a multi threaded socket server/client system.
Thanks for helping out

Related

Reclaiming a lost Facebook app

I am a new member of a team at my company reviving a legacy product that had Facebook integration, and we wish to continue developing the Facebook side of things, but we can't seem to find the credentials for logging into the app, or even who has access to it.
The app we are trying to recover is "HaloMobile". One thing to note though is the app name on posts is no longer a link. Does this mean the app has been disabled somehow?
I'm obviously not asking for credentials. At this point I'm just trying to "find" the app and possibly determine who is currently assigned as the administrator role, or what my options are. If there is an email address associated with the app, perhaps we can send a transfer request to that email?
If you could get retrieve two piece of information from your code-base, which are App ID and App Secret then you can retrieve the list of roles assigned in app using the following end point,
https://graph.facebook.com/<App_ID>/roles?access_token=<App_ID>|<App_Secret>
And once you know the role, along with the user Ids of the user assigned to it, you can move forward to recover the App by contacting him.
Also, you might want to give this documentation about Application a look, which lists out various fields you can retrieve for getting the required information to get access to your application back, like user_support_email
https://graph.facebook.com/<App_ID>?
fields=name,description,creator_uid,user_support_email
&access_token=<App_ID>|<App_Secret>

Where to store the sensitive data in vb.net securely

I have a vb.net application that uses my gmail smtp server settings and my password to send me the users feedback through the email, (I don't want to show my email to the users)
The problem is I want to store these data securely in the vb.net application so that It's hard for any hackers/crackers through (reverse engineering or programs like cheat engine) to get my gmail account data.
Any ideas are welcome.
You cannot be 100% secure, you could store the email in a resource file and use an obsficator to make it much harder to get at the string but it is possible to break it (encrypted resource files and strings). However Even if you used a different email address and setup a forwarding rule the password for that account could still be comprimised. Anything you have access to in code a hacker could potentially break into as the key will be in clear text at some point.
You have a number of secure options:
Setup a webservice to receive your messages and email them onto you/log them to a database
Log your messages to a 3rd Party system (irc? news? some p2p network, IM system), and pick um the messages later.
Setup a Source Control/issue site for your system, google code/bitbucket/something else that has the ability to receive issues via an api.
I don't know if this makes any sense but what I'd do is let the program run an external PHP script that sends the mail.
Basically, if I'm understanding your question, you don't want the password in clear text in your .exe. Correct?
The solution is simply to ENCRYPT the string in your program, then decrypt it at runtime (pass your decrypted variable to your e-mail function).
Any two-way encryption will work. For example:
http://www.vbdotnetforums.com/security/1240-encrypt-password.html
As other people pointed out saving the password to your email in your application is unsafe because somebody might be able to crack your code and retrieve your password.
For logging errors, I suggest creating a very small PHP script and putting it on a PHP server. When an error occurs in your VB.NET application, the application can send data to this .php script. The script can save the data in a file or in a MySQL database.
All the things you need for sending data to PHP scripts can be found in "System. Net. WebRequest" namespace in VB.NET.
If you cannot use a PHP script, you may use a combination of IsolatedStorage ("System.IO.IsolatedStorage" namespace) and Cryptography ("System.Security.Cryptography" namespace) to save sensitive data. But, this is not completely secure to savvy attackers.

SignalR: Get clients list for PersistentConnection

I searched google, SignalR wiki and SignalR code itself (for example, Broadcast function, Signaler and more), and found nothing.
I wrote ClientIDFactory and successfuly set ClientID to UserID.
It works, but now user cannot connect from more than one browser/tab.
I modified the function and added random string to the UserID. It works.
Now I need to find a way to get all connections for user(s), to send specific message to specific UserID.
I think about looping around client list, and find the UserID by string.split(), but other ways may be usefull.
I am not using Hub. only PersistentConnection.
Thanks,
I think your approach is not right hence this has surfaced. You have connect and disconnect method on server side to hook into. On Connection you need to persist connection with some meta data and then even if server restarts you can check meta data for unique user or unique client and reconnect them with new ID.
For example
If you are buying an item from mobile and you are not logged in (no meta data to relate to user) and you place 2 items in your basket. When you go on your desktop you wont see those two items in basket because server cannot relate to you as same user coming from same machine.
If you are logged in (meta data like email or username attached to current connection ID) and you browse from mobile and add 2 items in basket. When you login to your desktop (the new Connection ID can then be linked with same meta data email or userid) and then you can tell that its same user. If you then need to send a message to that user you have to send it to two client IDs which you can do by grouping them or sending it to two IDs.
If client lost connection ID it should be disconnected and on new connection it will have new connection ID so you should be thinking about mapping them.
If I connect with 7 IDs from 7 different mobiles notification would be sent to all 7 as long as your system knows that they are all intended recipient of this notifications. Implementation of persisting this knowledge is not part of signalR and so you have to implement it yourself.

AppEngine Channel API - Best way to check if a channel is still open (server side)

I have built a social network/dating type application on the AppEngine and am currently in the process of adding a chat built on top of the Channel API. However, the problem that I have is that users may reload or navigate to new pages while the chat is going on (as they can in Facebook). This means that the server doesn't easily know if it should generate a new channel ID token for a given client, or if a given client has already been assigned a channel token.
It would be extremely useful if there were a way to check (server side) if a particular client already has a channel open. For example, if I assign a client "Jack" a channel ID of "Jack-Jan-21-2010", then I would like to be able to check on the server side if there is already a channel open associated with the ID "Jack-Jan-21-2010". This can be (sort of) tracked on the client side by watching for an onerror() and onclose() callback, but I can't see anything server-side that allows me to just check if a channel associated with a given ID is already open.
Does anyone know an intelligent way to check (server side) if a channel has already been opened, while using the AppEngine Channel API?
Part 1: Solving your problem
See Part 2 below if you really need to track client connections, but I'm not sure from your question if what you're asking for will solve your problem.
Let me see if I can echo your problem back: you're writing a chat app, but it's for a site which isn't fully AJAX (in the way that, say, gmail is); the site contains page navigation where you may need to re-set up your channel after the user clicks on a link to another page. When the user navigates, the new page is rendered, and you want to avoid getting a new token at that point; you want to reuse the existing token and channel with the same client-id.
If that's correct, I have two alternate solutions, one easy but with not-great user experience, one trickier but with a much smoother end result.
Preserve the token in a cookie. When you re-render your page, just use the token from the cookie instead of calling channel.create_channel again. When the token expires you'll get an onerror callback just like if the user had stayed on the original page; at this point, call channel.create_channel again. The problem with this is that re-connection can be slow (up to 10 seconds or more in bad cases) because of the nature of Comet connections.
Wrap your entire site that's not chat-related in an iframe. Put your channel creation code and UI in the outer iframe. This way you don't have to re-connect every time the user navigates. This avoids the downtime on navigation. Note that orkut uses this technique, with floating divs, as a small amount of Firebug investigation will reveal.
Part 2: Your feature request
If it turns out I'm misunderstanding and you really do need to track client connections:
There's not a built-in way to check if a client is connected to a channel identified by a client-id now.
However, I am working right now on adding "presence" (in the chat sense) so that your app can register to get a post when a client connects to or disconnects from a channel created with a given client id. You also might be able to "probe" presence, to query whether a given client id is connected or not (still working on the details of this part).
Note that this won't be token-based, but rather client-id based.
I don't have a definite release date for this yet but as I said I'm actively working on it right now.
In the meantime, you could use a heartbeat HTTP request from your client back to your app that says, "hey, I'm still here" every minute or so. You'll need to have some sort of task that runs every, say, 2 minutes and marks any clients that haven't checked in as inactive, and you'll need to store this data someplace.

Active X User Control COM/COM+ Communication

Alright, well I wanted a system of communication between my webpage and a web service. I don't understand much about writing a web service and a problem I had was the fact that the web service itself would not have a user interface where I could view the processes. Then I thought about making an "ActiveX control that will show a simple user interface and accept input from a web page". So if I made an Active X control in VB.NET that had a textbox and the active x control read and responded to certain text submitted to the textbox on it from my website's form, would I have to have the web page with the active x user control open in another browser in order for it to accept a form submission from my website and respond?
Also second question: if multiple people used the form on my web site and submitted text to the active x control for it to read and respond based on how I coded it to respond to certain text, would it be able to handle multiple requests at once like a web service?
Is it just better to learn how to create a web service?
Unless you want to do what your browser does not allow your script to do (like accessing local resources that the browser does not expose via the script engine), I suggest you stay on web programming and use AJAX to talk to a web service you wrote. ActiveX has limited browser support and needs extra effort to obtain other computer's trust.