Contents tagged with C#
-
A Simple Online Document Management System Using Asp.net MVC 3
-
Emulating Synchronous Web Service Call in Silverlight 3
As we know, only option for web service calling in Silverlight is asynchronous and Silverlight framework does not provide any API for synchronous call. In this post, i will show how we can emulate synchronous web service call using the default asynchronous web service call mechanism of Silverlight.
-
How can we convert a local path to a UNC path in c#?
Uniform Naming Convention (UNC): According to wiki, UNC specifies a common syntax to describe the location of a network resource, such as a shared file, directory, or printer in Windows OS.
-
How to pick numbers at random from a given set of numbers in c#
The Random class defined in the .NET Framework provides functionality to generate pseudo-random number. According to MSDN, the current implementation of the Random class is based on Donald E. Knuth's subtractive random number generator algorithm. The random number generation starts from a seed value. If the same seed is used repeatedly, the same series of numbers is generated. One way to produce different sequences is to make the seed value time-dependent, thereby producing a different series with each new instance of Random.
-
Testing server whether it is reachable or not in c#
In client server development, we need this feature in many situations including:
-
How can we get the first IP4 Address of the local machine in c#?
When we write client server or peer to peer application, a frequent task is to find the first IP4 address of local machine. A machine has multiple types of addresses besides IP4 and IP6. For this reason, we will first get the address list of the machine then will loop through all the addresses to check whether there is an IP4 address. If found then we will return the first address. Otherwise will return null.
-
Testing whether two IP addresses are in the same network using c#.
IPv4 address has two basic parts: the network part and the host part. As we know, if network potions of two IPs are same, they are in the same network. By performing and operation between subnet mask and IP address, we can get the network portion of an IP. By this way, we have found the network portions of two IPs. Then just check whether the network portions are equal or not. For this the following code is written:
-
Finding subnet mask from IP4 address using c#.
IP4 addresses are categorized into 5 classes. For the first three classes we have predefined subnet mask. So if we can detect the class of an IP address , we can determine the corresponding subnet mask. The address ranges used for each class are given in the following table (Taken from wiki):
-
IP address spoofing in c# using P/Invoke
According to Wiki, the term IP (Internet Protocol) address spoofing refers to the creation of IP packets with a forged (spoofed) source IP address with the purpose of concealing the identity of the sender or impersonating another computing system. For one of my project, I needed IP spoofing. According to a requirement, I need to commutate with a device over crossover cable for configuring it. But the problem is , when device boots up , it gets an arbitrary IP when it is operating over crossover connection as it cannot contract with DHCP Server. My PC is in a different network from the device. So i cannot communicate with that device thru socket programming. But one thing I can do, i can search the device using some proprietary protocol and find its information like its IP.
-
JavaScript VS C# threading model
We were developing an application, which emulates the functionality of a real time device. In this application, we need real time event; we pool the service by a certain time interval and need to send some key presses. Moreover, we have a large number of timers to show real time effects of device by manipulating DOM elements.