ASP Razor CodeEngine

Submitted on: 12/4/2015 8:50:04 PM
By: Xakim 
Level: Advanced
User Rating: Unrated
Compatibility: ASP (Active Server Pages)
Views: 13170
author picture
     in classic ASP not support syntax Razor. for interpret Razor ViewEngine as dynamic code on classic ASP will be Razor CodeEngine allows you to use Razor syntax to build dynamic templates code and dynamic include. WebMatrix MVX framework is use the static Engine class in the Razor CodeEngine. WebMatrix MVX is MVC framework for building dynamic web sites with including the merged MVC, MVP, Web API, Web RPC and Web Pages on syntax Razor.

				<-- #Include File = "WebMatrix.INC" -->
<SCRIPT RunAt="Server" Language="VBScript">
 Set WAzure	= New WebMatrix
 Set WRPC	= New WebRemote
 Set	WMVX	= New WebWorker
 Set WRazor	= WMVX.WRazorEngine
 Private Sub WRPC_Worker
	WRPC.CreateValue "Post", "Account"
	WRPC.CreateValue "Posr", "ViewModel"
 End Sub
 Private Sub WMVX_InitModel
 Rem WRazor "RazorFile", "ModelName"
	WRazor "AppXRPC", "WAppRPC"
 Set WRPC.WebService = New WAppRPC
	WRazor "AppUser", ""
	WRazor "RazorApp", "WApp"
 End Sub
 Private Sub WApp_InitModel
	WApp.Sign WUser
 End Sub
 Private Sub WUser_InitModel
	WUser "WUCell", WRPC.ValueAs("Account", "Ghost")
 End Sub

dynamic include file "AppUser"
<SCRIPT RunAt="Server" Language="RazorEngine">
@Class WUserModel
 Private WMUser_, WUType_, WUSign_, WUPass_
 Private WUCell_, WUName_, WUNick_, WUMail_
 Private WUSuss_, WUPath_, WU_KEY_
 Public Property Let WDebug(ByVal NewValue)
 Set	WDebug_	= NewValue
	WDebug_.Define vbCrLf& ""
 End Property
 Public Default Sub Define(ByVal Value, ByVal NewValue)
 If Value = "WUCell"	Then WUCell_ = NewValue
 If Value = "WUName"	Then WUName_ = NewValue
 If Value = "WUMail"	Then WUMail_ = NewValue
 End Sub
 Public Property Get WUCell()
	WUCell	= WUCell_
 End Property
 Public Property Get WUName()
	WUName	= WUName_
 End Property
 Public Property Get WUMail()
	WUMail	= WUMail_
 End Property
End Class

dynamic include file "RazorApp"
<SCRIPT RunAt="Server" Language="RazorEngine">
 WUser = New WUserModel;
 var WUserName = WUser.WUName;
@if(WUser.WUCell == '')
 WRPC.Send2Cell WRPC.RandomKey;
 } else {

Hello @WUserName


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Advanced category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)

Other User Comments

 There are no comments on this submission.

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)

To post feedback, first please login.