Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does ASP.NET run like a WinForm program?

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "how ASP.NET runs like WinForm programs". In daily operation, I believe many people have doubts about how ASP.NET runs like WinForm programs. The editor consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the questions of "how ASP.NET runs like WinForm programs". Next, please follow the editor to study!

Mode of operation

Whether the tool is easy to use or not, the ease of operation is critical. Let's see how my tool starts a website.

In Windows Explorer, locate the directory of the website you want to start, and right-click, as shown below:

At this point, just click "load this directory as a website with FishAspnetLoader".

Yes, I'm right, that's fine, any directory is fine, and there's no need for you to copy any file to anywhere, [just right-click the mouse and click the menu].

The running effect of the website is as follows:

Do you think a WinForm program is running now?

What do you mean, no dialog box? Then take another look:

It's like a WinForm program now.

Supported ASP.NET program categories

As mentioned earlier, this gadget is designed to solve the problem of limited execution of ASP.NET programs. This tool can support both WebForm and MVC ASP.NET frameworks. Including my WEB framework also supports it.

Therefore, in theory, as long as it is an ASP.NET program, it should be able to run, the program will automatically identify, and does not need to make any settings. The same sentence: "just right-click the mouse and click the menu].

And the version of ASP.NET is not a problem, with full support from .net 2.0 to .net 4.0.

It's also a HTTP server.

I just mentioned that my tool can support right-clicking on any folder and loading as a website. Yes, I am not talking nonsense, even if that directory is not an ASP.NET program directory, is an ordinary file directory, or a static web page directory, it is OK, at this time and IIS behavior is the same, if the request is a static page, display the static page, encounter a directory, list the directory. And it will run faster than ASP.NET programs at this time. The reason is simple: the ASP.NET runtime environment is not loaded at this time.

Take an effect picture of the column catalog:

One more thing to add: unlike WebDev.WebServer.exe, as long as it is a file name or directory name that Windows can support, my tool can support it, which is exactly the same as the behavior of IIS.

Unfortunately, I haven't done that kind of pure static page website for a long time, so I don't take screenshots to show it. I think you understand.

Support for remote machine access

Seeing the previous screenshot, do you have an idea: if someone asks me for a file in the future, I will ask them to download it, which is safer than a shared directory.

Haha, if you have this idea, then I would like to congratulate you, your security awareness is not bad. Yes, my tool supports this feature: it allows remote machines to browse [directories loaded as websites] (not any directories).

For the sake of security, the program does not allow remote machines to connect by default and requires you to open it manually. The operation is also simple, as shown in the following figure:

The text description is: right-click the system tray icon and click the set Security parameters menu. The following dialog box appears:

This dialog box is very simple, I think you understand, skip 78 words here.

Not limited to Windows firewall

I just mentioned that it can be accessed by remote machines, but there is a problem: since WindowsXP, the operating system has integrated the function of firewall, and there are quite a lot of machines that turn on this function. If this is the case, there will be a problem with the aforementioned features: they may be blocked by firewalls! Oh, this tool is too bad, what kind of tool is not stopped by the firewall? Fortunately, my tool is not bothered by this problem, and it automatically adds it to the Windows Firewall exception list without interrupting your operation at all.

Windows 7's firewall can also support:

Respect everyone's operating habits

I pay more attention to the operational experience, and my tools also have good support for this idea, starting from the moment the website is launched.

When you load a directory as a website, the following dialog box appears, asking which browser you want to choose to browse the site:

Attention, there is also a small tick below, which is sometimes very convenient.

Even if you choose a browser and want to change it later, it's easy. Look at the following picture:

The text description is: right-click the system tray icon and click the Select browser menu. The following dialog box appears:

It still allows you to choose another browser. I installed five browsers. How many browsers did you install?

Built-in multi-tag browser support

My gadget, which has a built-in multi-tag browser (IE kernel), can still enjoy the multi-tag function even if only IE6 is installed on your machine. And there are two ways to switch:

Note: click the close button in the upper right corner of the window and the program does not exit completely. To exit the program, right-click the drag tray icon and click the "exit" menu.

And for the working mode of the built-in browser, you can also right-click the taskbar and exit the program directly. The following figure (Win7 does not seem to be supported):

Startup parameters and configuration files

My gadget, in order to provide some user-friendly support, can set some startup parameters at startup. At this point, you need to launch it from the Windows start menu, and the startup interface is as follows:

Note: when you have set the relevant startup parameters, you can save it, there is a [Save as] button on the dialog box, and the program will save these parameters as a siteconfig file.

A siteconfig file can hold the configuration parameters that a website needs to FishAspnetLoader when it starts.

For ease of operation, you can save the configuration parameters of frequently visited websites or directories to a siteconfig file.

When you right-click a menu on a folder in Explorer or pass a directory from the command line

FishAspnetLoader will look in the installation directory to see if there is a configuration for this directory

If not, continue to look for relevant configuration files in the target directory

If not, it will also check the [my documents] directory to see if there are any relevant configuration files.

If a relevant configuration file is found, read that configuration file.

When you start FishAspnetLoader from the start menu, the program displays the set Startup parameters dialog box.

If you are only browsing a directory or native Web site regularly, you can save the current settings as a file called: default.siteconfig.

Or, if you publish the site "as a tool", you can prepare this file in advance. Then this dialog will not appear in the future.

When you pass a directory path from the right-click menu or command line of the Explorer, and if no configuration for this directory is found

FishAspnetLoader will check to see if web.config exists in that directory, and if it does, load Asp.net Runtime, otherwise it won't load to speed up startup.

If this judgment does not apply to a directory, start FishAspnetLoader from the start menu and create a siteconfig file for that directory to specify the appropriate parameters.

The startup configuration file is designed to enable you to better customize the running behavior of the program, and I specifically provide some parameters to make the website better disguised as a normal desktop program in the built-in browser.

Not only that, the tool also supports command-line startup, you can receive a siteconfig file, you just have to write a batch and run the batch when you do the installation package.

Or refer to the shortcut approach for the installation package of another of my tools. The startup command line of that tool is easier.

You can also refer to the configuration file of this demo program.

In short: it is also to make it easy for you to use this tool.

Support for .NET 4.0

Description: only .net Frarmework 2.0 is needed to run this program.

However, if the website you are running is based on ASP.NET 3.5, you need to install .net 3.5, to run a website that runs .net 4.0, and to install .net 4.0

If you already have. Net framework 4. 0 installed on your machine and you want to enable. Net 4 support.

Just rename the file [FishAspnetLoader.exe.config.bak] in the installation directory to [FishAspnetLoader.exe.config].

At this point, the study of "how to run ASP.NET like a WinForm program" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report