Advertisement
gyrospring

✒ 0007.0012 VS2017 VB MVC5 Razor HomeController.vb

Apr 1st, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. Public Class HomeController
  2.  
  3.  
  4.  
  5.  
  6. Inherits System.Web.Mvc.Controller
  7.  
  8.  
  9.  
  10.  
  11. Function Index(ByVal IdIn As String, ByVal PathIn As String) As ActionResult
  12.  
  13.  
  14. Dim PathParsed As String = ""
  15. Dim FileName As String = ""
  16. Dim ViewPath As String = ""
  17.  
  18. If IdIn = "" Then Return View("~/views/home/index.vbhtml")
  19.  
  20. If PathIn <> "" Then
  21.  
  22. PathParsed = PathIn.ToLower
  23. If PathParsed.EndsWith("/") = True Then PathParsed = PathParsed.Substring(1, PathParsed.Length - 1)
  24.  
  25. End If
  26.  
  27. Select Case IdIn.ToLower
  28.  
  29. Case "about"
  30.  
  31. If PathIn = "" Then FileName = IdIn
  32.  
  33. End Select
  34.  
  35.  
  36. If FileName <> "" Then ViewPath = "~/views/home/" & FileName & ".vbhtml"
  37.  
  38.  
  39. If ViewPath = "" Then
  40.  
  41. Return HttpNotFound()
  42.  
  43. Else
  44.  
  45. Return View(ViewPath)
  46.  
  47. End If
  48.  
  49.  
  50. End Function
  51.  
  52.  
  53.  
  54.  
  55. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement