Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
203 views
in Technique[技术] by (71.8m points)

How to open a URL using browser after scanning QR code in C#?

I have created a QR code. I want to open my site after scanning the QR code, but it always only shows text. How can I open a website using a browser after scanning my QR code in C#?

Here is my qrcode.aspx.cs:

using MessagingToolkit.QRCode.Codec;
using System.Drawing;
using System.Drawing.Imaging;

namespace WebApplication3
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string url= "http://mysite/login.aspx";
            QRCodeEncoder encoder = new QRCodeEncoder();
            encoder.QRCodeScale = 10;
            System.Drawing.Image logo = System.Drawing.Image.FromFile(Server.MapPath("/img/logo.gif"));

            Bitmap img = encoder.Encode(url);
            Graphics g = Graphics.FromImage(img);
            int left = (img.Width - logo.Width) / 2;
            int top = (img.Height - logo.Height) / 2;
            g.DrawImage(logo, new Point(left, top));
            img.Save(Server.MapPath("/qrcode/" + url+ ".jpg"), ImageFormat.Jpeg);
            Image1.ImageUrl = "/qrcode/" + url+ ".jpg";
        }
    }
}
question from:https://stackoverflow.com/questions/65862023/how-to-open-a-url-using-browser-after-scanning-qr-code-in-c

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...