Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Share JS Variable values between Razor .cshtml and Html file (a Html solution in the same solution)

I have a MVC Razor solution in which I have a separate HTML project(folder name Sub_HtmlProject from the attachment).

Question: How to use a JavaScript variable 'razorJSVar' defined in this Razor _Layout.cshtml Views > Shared > _Layout.cshtml

To:

Sub_HtmlProject > index.html

Please note I would like to have a solution without using LocalStorage, Session, DB storage or any browser storage options.

enter image description here**

like image 580
Dhana Avatar asked Nov 07 '19 21:11

Dhana


Video Answer


1 Answers

Developer_29,

The issue is that you need to make index.html into index.cshtml and use the layout on that index.cshtml page.

like image 183
John Meek Avatar answered Nov 01 '22 01:11

John Meek