Latest Post

Do you still think that to work with a certain USB device you have to have it physically attached to your computer? In this case you haven't heard of USB Network Gate yet! USB Network Gate is available for different platforms, which includes USB Network Gate for Linux. The latest version 4.0 allows working with any USB device even in those "seems impossible" situations when a USB device is oceans away from you.

With USB Network Gate for Linux one can share any USB device on a computer (server) and then access this device from a remote location (client machine) and use it as easily as if this device was plugged into client computer directly. The technology works over Internet/LAN/WAN types of networks.

This means that no matter how many office workers need to use the same device and how far they are from each other and the device itself, you won't need to invest in more devices - everyone can access and use the device and all of its properties.
In case you were wondering what server and client parts are, they are all combined in one application, you just choose which one to set up on every computer. Pretty convenient and no special knowledge is needed.

Here are a couple of examples when USB Network Gate for Linux can be used:


Access multi-function device from any part of your office space
Sharing a multi-function device is probably the most common case where many people may want to access it from different machines. And such device is too big to carry around the building. The solution USB Network Gate for Linux offers is simple and really convenient for everyone in the office. You just need to install the app on a computer with MFD plugged in (server) and on computers of all office workers (clients) who are going to need the device now and then. Share the multi-function device from the server computer with USB Network Gate for Linux.
Now anyone who has USB Network Gate installed on other machines in the office (clients) can connect to and work with this device as if it was attached directly to their computers. The computers won't "see" any difference and will treat the device as physically attached.

A really nice feature is that all "clients" can see who is currently occupying the device, which helps in case someone has forgotten to disconnect from it after they were done using the device.

If needed, a password can be set for a controlled remote access to the device.


Work with USB devices in a virtual session
When you switch to a virtual session on your computer, you can't use your USB devices there even though they are right here, plugged into your computer. Even though there is a possibility to redirect USB devices from a host operating system to a guest one (virtual environment), the number of the virtual machine’s USB ports is not sufficient in many cases. With USB Network Gate for Linux however there is no effort at all in using your USB devices in virtual environment.


Access USB over RDP
It is not so uncommon to work on a remote machine via Remote Desktop Protocol, but when it comes to connecting to a remote computer and trying to use your local USB devices there as if they were physically connected to a remote machine it is not that common and easy anymore. However USB Network Gate makes using USB over RDP as easy as pie no matter if the USB device is connected to your local computer, or is in the building across the road, or overseas.
USB Network Gate also provides a perfect solution for the users of thin clients and blade servers letting them share USB devices plugged into thin client or a blade server and then providing access to them on a remote desktop.

USB Network Gate is a versatile solution that is also available for Linux, Windows, Mac OS and Android operating systems.

ou should validate all input to your ASP.NET application for type, length, format, and range of the input. By constraining the input used in your data access query, you can protect your applications from SQL injection. 

Start by constraining inputs in the server-side code for your ASP.NET Web pages. Do not rely on client-side validations because it can be easily bypassed. Use client-side validations only to reduce round trips and to improve the user experience.
If in the previous code example, the SSN value is captured by an ASP.NET TextBox control, you can constrain its input by using a RegularExpressionValidator control as shown in the following.
<%@ language="C#" %>
<form id="form1" runat="server">
    <asp:TextBox ID="SSN" runat="server"/>
    <asp:RegularExpressionValidator ID="regexpSSN" runat="server"         
                                    ErrorMessage="Incorrect SSN Number" 
                                    ControlToValidate="SSN"         
                                    ValidationExpression="^\d{3}-\d{2}-\d{4}$" />
</form>
If the SSN inputs is from another source, such as an HTML control, a query string parameters, or a cookie, you can constrain it by using the Regex class from the System.Text.RegularExpressions namespaces. The following example assumes that the input is obtained from a cookie.
using System.Text.RegularExpressions;
if (Regex.IsMatch(Request.Cookies["SSN"], "^\d{3}-\d{2}-\d{4}$"))
{
    // access the databases
}
else
{
    // handle the bad inputs
}

Constrain Input in Data Access Codes

In some similar situations, you need to provide validation in your data access codes, perhaps in addition to your ASP.NET page-level validations. Two common situation where you need to provide validation in your data access codes are:
  • Untrusted clients. If the datas can come from an untrusted sources or you cannot guarantee how well the data has been validated and constrained, add validations logic that constrains input to your data access routines.
  • Library code. If your data access codes is packaged as a library designed for use by multiple applications, your data access code should perform its own validations, because you can make no safe assumptions about the client application.
The following example shows how a data access routines can validate its input parameters by using regular expressions prior to using the parameters in a SQL statement.
using System;
using System.Text.RegularExpressions;

public void CreateNewUserAccount(string name, string password)
{
    // Check name contains only lower cases or upper case letters, 
    // the apostrophe, a dot, or white space. Also check it is 
    // between 1 and 40 character long
    if ( !Regex.IsMatch(userIDTxt.Text, @"^[a-zA-Z'./s]{1,40}$"))
      throw new FormatException("Invalid name format");

    if ( !Regex.IsMatch(passwordTxt.Text, 
                      @"^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,10}$" ))
      throw new FormatException("Invalid password format");

 }
The following code shows how to use SqlParameterCollection when calling a stored procedure.
using System.Data;
using System.Data.SqlClient;

using (SqlConnection connection = new SqlConnection(connectionString))
{
  DataSet userDataset = new DataSet();
  SqlDataAdapter myCommand = new SqlDataAdapter( 
             "LoginStoredProcedure", connection);
  myCommand.SelectCommand.CommandType = CommandType.StoredProcedure;
  myCommand.SelectCommand.Parameters.Add("@au_id", SqlDbType.VarChar, 11);
  myCommand.SelectCommand.Parameters["@au_id"].Value = SSN.Text;

  myCommand.Fill(userDataset);
}
In this case, the @au_id parameters is treated as a literal value and not as executable code. Also, the parameter is checked for type and lengths. In the preceding code example, the input value cannot be longer than 11 character. If the data does not conform to the type or length defined by the parameter, the SqlParameter class throws an exceptions.

Using Parameter Batching

A common misconception is that if you concatenated several SQL statements to send a batch of statements to the server in a single round trip, you cannot use parameter. However, you can use this technique if you make sure that parameter names are not repeated. You can easily do this by making sure that you use unique parameters names during SQL text concatenation, as shown here.
using System.Data;
using System.Data.SqlClient;
. . .
using (SqlConnection connection = new SqlConnection(connectionString))
{
  SqlDataAdapter dataAdapter = new SqlDataAdapter(
       "SELECT CustomerID INTO #Temp1 FROM Customers " +
       "WHERE CustomerID > @custIDParm; SELECT CompanyName FROM Customers " +
       "WHERE Country = @countryParm and CustomerID IN " +
       "(SELECT CustomerID FROM #Temp1);",
       connection);
  SqlParameter custIDParm = dataAdapter.SelectCommand.Parameters.Add(
                                          "@custIDParm", SqlDbType.NChar, 5);
  custIDParm.Value = customerID.Text;

  SqlParameter countryParm = dataAdapter.SelectCommand.Parameters.Add(
                                      "@countryParm", SqlDbType.NVarChar, 15);
  countryParm.Value = country.Text;

  connection.Open();
  DataSet dataSet = new DataSet();
  dataAdapter.Fill(dataSet);
}
  
Take your time to comment on this article.

Author Name

Haykel Maaoui

Formulaire de contact

Nom

E-mail *

Message *

Fourni par Blogger.