How to get hostname or unique identification of computers? - c#

We have an app (ASP.Net 3.1 Core MVC,SQL Server) that is deployed internally (network) wherein we can only access the app by using AnyConnect VPN. It is also given that we have a remote connection in an onsite computer.
Can you give me an idea or suggestions on how to identify the client if he/she is working at home or at the office. I tried searching here in SO on how to get Hostname , it works on the physically connected to the network computer at the office but it does not work when the app is accessed externally (through VPN).
Any suggestions would be greatly appreciated !

Related

NancyFx - Find the server over a local network

Scenario: I have a small POS system running in a brick-and-mortar store. The software is running in Windows machines with SQL Server 2008 - 2012 (it varies). There are Android tablets that need to connect to the server in someway to get the data inside SQL Server.
My plan right now is to create some REST Web services using NancyFx and host them as a Windows Service inside the Windows machines. Then the Android tablets will need to connect to the server via HTTP in order to consume the REST API.
I have a problem (perhaps more than one): the network in the brick-and-mortar store is not that reliable and the Wi-Fi signal might decrease for whatever reason.
Question: Is there a way to automatically find the IP or machine name of the server (the one with the REST API) even if these properties change for some reason (unknown network issues or so)?
Yes, the server and the tablets are going to be on the same local network.
it's more of a network problem than programming issue. you must have a DHCP server installed in your LAN. use that to assign an IP to the server with a fixed lease. that way you fix the address of server. clients should preferably connect to that server using its name. since it's a Windows network, name would resolve to the ip address.
that is the simplest solution i can think of

How to setup a development environment for UCMA Lync bot?

I have to create a Lync 2010 bot. The initial idea that I pitched for the development purposes was to create the application on my own laptop and add the application as a trusted application endpoint to the production lync server. In that way I can develop and test the bot on my machine.
But, this idea was not highly encouraged by Microsoft themselves and they recommended to create a development lab environment to develop the application. I have done my fair share of research and have come to conclusion of adding 2 VMs -
1) 1st VM will serve as the AD server. My question is, what all things/roles should be added to this server like DHCP, DNS, IIS etc.?
2) 2nd will be Lync Server. Here I will create the connection with the AD server. Again, how will the connection be done? What extra roles should this server fulfill?
3) My laptop will act as the application server and I will add my laptop and the application as an application endpoint to the Lync server. Can I create all the three things on a single VM and not worry about multiple VMs?
4) Do I need an exchange server? If yes then why?
Any help is appreciated. Thanks.

Connecting to SQL Azure database from client applications

I have a bunch of small desktop applications for which I have a simple database for keeping user data (who uses which app and in which version) etc.
I want the apps to connect to Azure SQL server and update database record when they're started. My apps have the ADO.NET connection string hardcoded in them.
It works fine from my home network and my company guest network - however, the corporate network has got some of the ports disabled, and that apparently includes port 1433. As per Microsoft troubleshooting guide, I tried telnet and failed.
C:\Users\xxx>telnet 65.55.74.144 1433
Connecting To 65.55.74.144...Could not open connection to the host, on port 143
: Connect failed
I cannot connect neither via my applications, nor by SQL Server explorer in Visual Studio.
So, the question is - how can I get around this problem? It is highly doubtful that corporate IT will unlock a port just because I ask, besides I want to keep it as simple, low profile and independent as possible. Or maybe my approach is incorrect from the very beginning and I should do stuff differently?
Cheers
Bartek
You can't.
Make your desktop applications talk to web services instead, over HTTP/HTTPS. Among other things this will also allow a more controlled access (right now anyone can connect to your database and modify the data, since your access credentials are publicly shared with your app).
A side effect of using we services is that 80/443 are almost always opened in all corp firewalls.

How to connect and test connection to an Active Directory Server on a different computer

I was given a computer in which a virtual machine is running and has an Active Directory Server. I'm connected from my computer to this one through a switch.
I've read some guides such as:https://serverfault.com/questions/130543/how-can-i-figure-out-my-ldap-connection-string and http://www.schiffhauer.com/mvc-5-and-active-directory-authentication/
But this one assumes the server is on my computer which is not. How would I build a connection string for this situation and how would I test if the connection is working?
I'm currently building an ASP.NET Web API 2 which I chose at the beguinning to have no authentication and now I need to use Active Directory for authentication on login and authorization when accessing certain pages.
PS: I had never even heard of Active Directory until this was asked of me so sorry if this is a really simple question.

How to host a web service so other clients connected to same network can access

I am hosting web service in a one machine using Visual studio 2008. I tried accessing the web service from a web site i created in the same solution and it was successfully called. Now i want to access the web service from a remote client.
I initially developed the web service to used in an android application. As you can see if I wan to access the web service I will have to host is with a static IP. So at least to test the application i want access the web service from the android mobile by connecting both server and android mobile to one wifi network. For the initial test I connected two laptops(one is server) to the wifi router. And i pingd the server from the client machine and it got successfully pingd. But when i try to access the web service with given port from the browser it wont allow me to connect. I tried http://localhost:26796/ by replacing the localhost with ip of the server and also i tried making a small web site(asp) and try to access it from the client via IP. Both did not work. I have searched here and on web could not find a proper answer. for,
how to host a webservice so other clients in the same network can access..?
can it be fulfilled with VSD server..?
is it compulsory to use iis..?
How should i achieve this..?
NOTE: Moved from comments to answer as per user suggestion.
Publish the web service to your local machine's IIS as an Application. Then you can access the site from anywhere in your network. Running it directly from VS means it's hosted inside VS's ASP.NET Development Server (which, by default is only accessible locally). You can try opening up the port specified in the ASP.NET development server that starts up on your machine's local firewall, then you can access the debug instance being hosted

Categories