使用浏览器中的动态参数创建exe运行时 [英] create exe runtime with dynamic parameter from browser
问题描述
嗨专家,
我想为我网站的每位访客创建一个exe。
对于我网站上的每个访问者,我将生成一个唯一的代码(6位数代码)。我想将我的标准exe与这个6位代码集成。在安装这个exe时,我需要检查这段代码是否有效?
这样可行吗?。然后如何。请指导。
例如。在使用Logmein(网站:http://support.me)时,访问者提供了一个预生成的6位数代码,然后exe下载了这个exe与此代码有一些连接只在这台PC上有效且只有一个有效的代码和代码仅存在20分钟。如果在20分钟后使用,exe将无法工作。
注意:此代码保存在cookie中。但是在浏览器外读取cookie是否可行。
任何帮助或指导都将受到高度赞赏。谢谢提前
语言:Asp.net,c#
Hi Experts,
I want to create a exe for each visitor of my website.
For every visitor on my website,i will generate a unique code(6 digit code).I want to integrate my standard exe with this 6 digit code. On installation of this exe,i need to check this code is valid or not?
Is that feasible?.if then then how. Please guide.
For Eg. While using Logmein(website:http://support.me), visitor provide a pre generated 6 digit code,then a exe got downloaded and this exe has some connection with this code.exe is valid only on this pc and only with a valid code and code exist only for 20 minutes. Exe won't work if it is getting used after 20 min.
Note: this code is saved in cookies. But is it feasible to read cookies outside a browser.
Any help or guidance will be highly appreciated.Thanks in advance
Language: Asp.net,c#
推荐答案
.net应用程序很少是单个可执行文件。但在这种情况下,您需要一个可执行文件。
让我们看看你有什么选择:
1)在交付给客户之前,你有一个现成的编译器。确实有复杂方法 [ ^ ]您可以实现更改已经编译的IL代码以添加您打算使用的特定数据。
2)在运行时更改代码并编译项目。。那么,您的项目结构必须非常简单才能有效。看看这里 [ ^ ]。您也可以使用 Roslyn [ ^ ]或传统动态代码生成 [ ^ ]在运行时构建您的应用程序。不过,这也是一项艰苦的工作。
3)合并预建和自定义组合。像你一样构建你的组合,但是在静态类中有一个包含这些特定信息的组合。您可以根据请求更改此单个组件的代码,并将其强制执行。由于它很简短,因此可以快速,轻松地编译。之后使用 ILmerge [ ^ ]将所有assambiles合并为一个可执行文件。
我会首先尝试最后一个......
至于第二个想法:你无法从浏览器外部访问cookie。好吧,你可以尝试从文件系统,但每个浏览器以不同的方式存储cookie。
A .net application is rarely a single executable. But in a case as this, you need to have a single executable.
Let's see what options you have:
1) Have a ready-compiled assambly you alter before delivering it to the client. There are really complex methods[^] you could implement to alter the allready compiled IL code to add the specific data you intend to use.
2) Alter code and compile project at run-time.. Well, your project structure has to be really simple to be effective. Have a look also here[^]. You could use also Roslyn[^] or legacy dynamic code generation[^] to construct your application on run-time. Still, this is also hard work.
3) Merge pre-built and custom assamblies. Build you assamblies as you did, but have a single assambly containing those specific information in a static class for example. You alter the code of this single assambly on request, conpile it. As it is a short, it will compile quickly, and easily. After that use ILmerge[^] to merge all assambiles into one executable.
I would try this last one first...
As for the second idea: you can't access cookies from outside the browser. Well, you could try from file system, but every browser stores cookies in a different way.
这篇关于使用浏览器中的动态参数创建exe运行时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!