I want to add Copyright @ 'current_year' to the footer (in cshtml file) of my page. I often made it using javascript but since I am using ASP.NET MVC 3 I would like to do this using ASP.
I was trying construction like:
@response.write("Current Year: "&Year(Date))
But it didn't work in MVC 3 and I can't find solution tha开发者_JS百科t is working.
Try the following:
Copyright @@ @DateTime.Now.Year
In a .razor page in an ASP.NET Core application, e.g. within the <div> </div>
of your footer, the following works too:
Copyright © @DateTime.Now.Year
Added the copyright sign too and the double @@ is not needed in a razor page; it gives an error.
精彩评论