C # uses DirectoryEntry to manipulate IIS to create Web sites and virtual paths

Source: Internet
Author: User

There is a better solution for string parameter substitution in. NET Razorengine
We recommend you look at the original site, and then make a small connection, and then you understand.

First you have to download one,

vs tools-> Library Paging Manager->manager Nuget in then what Install-package razorengine wait for the search to end and then download down two DLLs

RazorEngine.dll didn't see? must refer to the project.

System.Web.Razor.dll This DLL project is a reference to the many to be prompted to replace, do not hesitate to replace it, and then right-click the DLL to see his version oh, because version of the inconsistency is Will cause the DLL to find no drops! Change the version on the Web. config, and then add the RazorEngine.dll to config as well!
So we can use the Razorengine!

To be in C # backstage code with HA ~, or how to compile it

Razorengine will generate a temporary. cs file for the template, and then compile and invoke it.

 
//string can also be a JS string
//@ "<script type= ' text/javascript ';
//Balabala a bunch of JS code
//</script>" This is also possible.

string template =
  @ " <        html>   "        var  model = new  Pagemodel {Name =  world  " Span style= "Color:rgb (128, 0, 0); > ", Email = "  [email   Protected]   " };  string  result = Razor.parse (template, model);  

See if it is very simple to use,@Model This represents the Pagemodel object, the return value of the C # method to go to a htmlstring, the premise is that the data is a code that can be run directly in HTML

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.