qrcode scan to return value

Hi Experts,
I am currently working on a multiplatform solution that has a winform module, asp.net module and html5 mobile module.
One aspect of the solution is the creation of a qr or pdf417 code, embedding a url and parameter into the qr/pdf.
The creation part is done. I need help with the creation and method to publish an aspx page on my web server to get the parameter passed and return an image to the calling page.

Additional info.
The solution I am looking for is to achieve a similar result as when you would do a Form POST to a PHP server side script that Returns (ECHO) a response or image.
My initial question is to do someting similar with the qrcode by passing a parameter as part of a url embedded in the qrcode to an aspx page that will process the parameter and return a result. I need an example of the aspx process and page

Update:

I have completed the part of the system that create the qrcode. The qrcode has an embedded url and parameter after it was generated. Now if you scan the qrcode (with a mobile device as example) the code read is for example:
"http://www.itjust.biz/cm/ContentQueryForm.aspx?qrcode=" + usernameTextBox.Text;
what I now want help with is the ContentQueryForm.aspx to process the request, search the DB for the user, get his picture and returns the picture.
I have done something similar where the processing form is PHP. I need an example of doing this in the .aspx page.
Sample of my PHP form is as below:
$user =  $_POST['firstname']; 
$last = $_POST['lastname']; 
$serverName = "zzzz";
$connectionInfo = array( "Database"=>"zzz", "UID"=>"zzz", "PWD"=>"zzz");
$conn = sqlsrv_connect( $serverName, $connectionInfo );
if( $conn === false ) {
    die( print_r( sqlsrv_errors(), true));
}      else {
            echo "The following notices/Incidents are for your attention.<br />";
}

$sql = "SELECT Username, Image1 FROM Vehicles WHERE Username = (?)";
$params = array(&$_REQUEST['firstname']);
$stmt = sqlsrv_query( $conn, $sql, $params );
if( $stmt === false) {
    echo "Your details was not found. Please try again or Register <br />";
      die( print_r( sqlsrv_errors(), true) );
      }

while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) ) {
$SQL_DateTime = date("D, d M Y H:i:s T", strtotime('IncidentDate') );
echo $SQL_DateTime;
echo "\r\n";
echo $row['Username'].", ".$row['Image1']."<br />";
echo "<img src='".$row['Image1']."' />";
$image = $row['Image1'];
echo "<input type='text' name='lastname' value='$image' />";
  echo "Goodbye! <br />";

/* Free statement and connection resources. */
sqlsrv_free_stmt( $stmt);
sqlsrv_close( $conn);
}
?>

Open in new window

Zack SnydersAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

gheistCommented:
You can use zxing .net QR generator.
At least java version is best there is... (for free)
Zack SnydersAuthor Commented:
Hi gheist,
Thank you but you have not read my question and edits.
Generating the qrcode is not my issue. This is done. I am looking for an .aspx solution to handle parameters passed as part of a url AND to handle a POST from an ASP.NET web form.
Basically an .aspx flavour of the the PHP example I have posted above
rgs
aikimarkCommented:
How about compiling your PHP code into a .Net assembly
http://www.php-compiler.net/
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Zack SnydersAuthor Commented:
Hi aikimark
Good response.
That certainly is an option and would be my last resort.
I would still however prefer a pure .net solution due to the nature of the total solution.
Rgs
gheistCommented:
I do not see QR code generated in your PHP code.
So use ZXING.NET library to generate one after copying both SQL statements to .NET program
aikimarkCommented:
It is possible to render a .Net assembly into any .Net language you want.
gheistCommented:
The problem is PHP code of 2 SQL statements does not yield any QR output
Fastest is to re-implement it in pure .NET
Zack SnydersAuthor Commented:
@gheist,
I make use of aspose.barcode library for .net to generate the required qrcode. Embedded in the qrcode in the url with parameter that I need.
The PHP I included as a sample is not specifically related to the qrcode. It is a sample of a different mobile app where I post a form to PHP script which returns an image.
I have written a custom mobile qrreader app on android that read the qrcode in question and send the url with parameter to a page. It is THIS PAGE that I need help with. To receive the parameters, process them, query sqlserver database and then return text and image.
gheistCommented:
Random copy/paste is of no help. Please port your PHP code to .net
Ray PaseurCommented:
Got a neglected question alert on this, but it doesn't really seem like a question with an answer -- it seems to be a requirement for application development.  If it's any help, I use QRafter on the iPhone.  It works pretty well and is worth checking out, if only for the value of the design pattern.  
https://itunes.apple.com/us/app/qrafter-qr-code-barcode-reader/id416098700?mt=8

I've used this script in PHP.  Google has (or had, not sure if they still offer it for free) a QR Code generator.  It appears to be deprecated now.  But there are lots of alternative web services that can do the heavy lifting.
https://google-developers.appspot.com/chart/infographics/docs/qr_codes

<?php // demo/qr_code.php

/**
 * GENERATE QR CODE IMAGES
 * SEE https://google-developers.appspot.com/chart/infographics/docs/overview
 * SEE https://google-developers.appspot.com/chart/infographics/docs/qr_codes
 * SAMPLE https://chart.googleapis.com/chart?chs=150x150&cht=qr&chl=Hello%20world
 * ACHTUNG http://www.mediapost.com/publications/article/160932/qr-malware-surfaces-on-apps.html
 */
error_reporting(E_ALL);

// THE DIRECTORY FOR THE QR CODES
$dir = 'storage';

// DETERMINE THE SIZE
$s = "144";
if (!empty($_GET["size"]))
{
    $s = strtoupper(trim($_GET["size"]));
    switch($s)
    {
        case "S" : $s =  72; break;
        case "M" : $s = 144; break;
        case "L" : $s = 288; break;
        case "G" : $s = 547; break; // LARGEST FROM TESTS ON 2011-10-20
    }
}
$chs = $s . 'x' . $s;

// IF THERE IS DATA
$q = NULL;
if (!empty($_GET["q"]))
{
    $q = $_GET["q"];

    // MAKE A FILE NAME (UNDERSCORES REPLACE INAPPROPRIATE CHARACTERS)
    $f = $q;
    $f = preg_replace('#[^ A-Z0-9/:?&\+\.]#i', NULL, $f);
    $f = str_replace(' ', '_', $f);
    $f = preg_replace('#[^A-Z0-9]#i', '_', $f);
    $f = preg_replace('#_+#', '_', $f);

    // CALL THE QR CODER
    $url
    = 'https://chart.googleapis.com/chart?'
    . 'cht=qr'          // CREATE A QR CODE
    . '&'
    . 'choe=ISO-8859-1' // ENCODING
    . '&'
    . "chs=$chs"        // PIXEL DIMENSIONS (SQUARE)
    . '&'
    . 'chld=Q'          // QUALITY ERROR RECOVERY IMPLIES UP TO 67 ALPHA-NUMERICS IN LEVEL 4
    . '&'
    . 'chl='            // THE URLENCODED STRING
    . urlencode($q);
    ;
    $qrc = file_get_contents($url);

    // WRITE THE IMAGE
    $lnk = $dir . DIRECTORY_SEPARATOR . "QR_CODE_$f" . '.png';
    file_put_contents($lnk, $qrc);

    // CONSTRUCT THE RESPONSE
    $txt = htmlentities($q);
$out = <<<OUT
<p>Voila! Here is the QR code for <b>$txt</b></p>
<p><img src="$lnk" title="$f" /></p>
<p>Right-click and save the image, or use this: <a target="_blank" href="$lnk">$f.png</a></p>
OUT;
    echo $out;
}

$form = <<<FORM
Enter up to 67 characters to see the QR code (maybe a URL?)
<form>
<input type="text"   name="q"    value="$q" size="67" style="font-family:Courier;" /><br/>
<input type="radio"  name="size" value="S" />Small (probably too small)<br/>
<input type="radio"  name="size" value="M" />Medium (default value; probably just right)<br/>
<input type="radio"  name="size" value="L" />Large<br/>
<input type="radio"  name="size" value="G" />Gigantic<br/>
<input type="submit"             value="Get QR code" />
</form>
FORM;

echo $form;

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Zack SnydersAuthor Commented:
Thank you for all your comments which are good and has helped me.
Rgs
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.