No idea why you would need to get the current view name but you could use the VirtualPath
property inside a view. Normally it's more useful to know the current action or controller. But anyway, here's how to get the current view name:
@VirtualPath
and if you wanted to get only the filename:
@Path.GetFileName(Server.MapPath(VirtualPath))
and without the extension:
@Path.GetFileNameWithoutExtension(Server.MapPath(VirtualPath))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…