Question

Long story short:

I've got some C#-Code which shows me the file "hello.html" by default.

Get["/"] = parameters =>
{
  return View["hello", this.Request.Url];
};

Now i'd like to do the project with VB.NET and I tried to convert the Code but I get a Http-Erorrcode '500'

MyBase.Get("/") = Function(parameters)
   Return View("hello", Request.Url)
End Function

Edit: I've to say that the C#-Code bases on the Nancy-Version 0.18.0.0 and the VB.net on 0.22.2.0.

I cant find any code in VB.Net on the internet. Has anyone any idea how to fix this?

Was it helpful?

Solution

There's a whole heap of resources on VB.NET from the Wiki:

https://github.com/NancyFx/Nancy/wiki/Blog-Posts%2C-Video-%26-Audio#vbnet

To answer your question though.

The most basic example would be something like this:

Imports Nancy

Public Class HelloModule
    Inherits NancyModule

    Public Sub New()
        MyBase.Get("/") = Function(parameters) "Hello World"
    End Sub

End Class

Just to return a string.

If that's working then it probably something to do with your view, or the parameter to the view.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top