nancy

how does System.Web.HttpRequest::PathInfo work?

北城余情 提交于 2019-12-12 18:22:30
问题 I am trying to understand the PathInfo property of System.Web.HttpRequest and how it is set. Why would it be empty in the following example? var p = new System.Web.HttpRequest("file.txt","http://file.com/files/file.txt",""); //PathInfo is always empty return string.IsNullOrEmpty(p.PathInfo) I am trying to pipe the Elmah interface through Nancyfx by invoking the Elmah.ErrorLogPageFactory::ProcessRequest(HttpContext context). but it does not work because Elmah.ErrorLogPageFactory depends on

Nancy - Super Simple View Engine: How do I override a MasterPage's title in the view?

烈酒焚心 提交于 2019-12-12 15:46:16
问题 I would like to set the title of each rendered page from the corresponding view. I would also like a default title to be set in my Master page. Here is the super-simple set up I am using. Master Page <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>NancyFX is Splendid</title> </head> <body> @Section['Content'] </body> </html> View @Master['_Master'] @Section['Content'] <h1>Home</h1> <p>Hello @Model.UserName</p> @EndSection I have tried a few of the more obvious

SSL: NancyFx Selfhost Mono Linux (pi)

爷,独闯天下 提交于 2019-12-12 08:54:22
问题 I am new to linux (PI) and mono, applogies for the newbie question How do I run NancyFx, shelf host, over https, on mono/linux/pi? If i am able to create a certificate using OpenSsl (cer file), how do I assign it to a port? in the docs show how to do this for windows (here https://github.com/NancyFx/Nancy/wiki/Accessing-the-client-certificate-when-using-SSL#configuration-of-hostingself) thanks 回答1: I have no knowledge of PI at all, but I assume it's not much different than hosting on any

Loading image from remote server in different LAN

♀尐吖头ヾ 提交于 2019-12-12 05:26:56
问题 My stack is ASP.NET (Nancy) with Razor view engine. But this may concern all technologies I suppose. I have two LAN networks (let's call them Large network and Small network) and two servers (a.k.a Main server and Image server). Main server can be reached by computers from both networks but Image server is visible only for machines in Small network. I have website served by Main server which shows images from remote (Image) server: <img src="http://ImageServer/image.png"/> All is fine when

How to implement SaveChanges with Breeze js and Nancy

蓝咒 提交于 2019-12-12 03:25:30
问题 I have an Angular JS application with Breeze and Nancy (self-hosted with Owin). I've figured out how to get data from server with Breeze, but now I'm trying to save changes using Breeze and have problems with it. I've seen MVC examples like: [HttpPost] public SaveResult SaveChanges(JObject saveBundle) { return _repository.SaveChanges(saveBundle); } But obviously I can't do the same with Nancy. My application sends POST request to SaveChanges but then breaks with TypeError: undefined is not a

NuGet Fails to Install FluentValidation

有些话、适合烂在心里 提交于 2019-12-11 19:27:08
问题 I am attempting to install the NuGet package Nancy.Validation.FluentValidation but the installation fails due to, I think, unsupported frameworks? The full NuGet error is below. I am using .NET 4.5. I cant see why it would fail? Any ideas what is going wrong? Output when installing Nancy.Validation.FluentValidation : Attempting to resolve dependency 'Nancy (≥ 1.2.0)'. Attempting to resolve dependency 'FluentValidation'. Installing 'FluentValidation 5.6.2.0'. Successfully installed

C# IOC and Request State in NancyFX

∥☆過路亽.° 提交于 2019-12-11 14:33:59
问题 I want to inject a class into my module using the IOC framework in NancyFX, and I want that class to have access to the Context, just like the module does. How would I do that? The module has a property called Context, that doesn't seem to be injected (nor should it be, as it is the request state)... how does that work, and is that thread safe? Thanks 回答1: Assuming you use the DefaultNancyBootstrapper as a base for your bootstrapper you register your dependency in your container on a per

Safe to use a nancy module property as 'per-request' storage?

僤鯓⒐⒋嵵緔 提交于 2019-12-11 13:43:08
问题 Aside from being a bad, bad pattern in general, are there any ramifications of doing something like this to store an object as a property on the nancy module for the life of the request? Everything looks okay but not sure if this will result in any weirdness at scale... ie, cross-talk between requests, memory leaks, general shenanigans. public class APIModule : NancyModule { public SomeConvolutedThing MyThing { get; set; } public APIModule() { Before += ctx => { try {

NancyFx Queries to JSON files stripping the JSON extension from request URL

▼魔方 西西 提交于 2019-12-11 08:39:48
问题 In one project I'm using Nancy to serve basic web content via Nancy Self-Host. This generally works, but unfortunately, running queries on endpoints ie http://localhost/data.json results in the module receiving a request url of http://localhost/data . When I query localhost/data.json I get a nancy-generated 404 response... in JSON. I have no clue why this is happening, and can't find this behavior documented anywhere. Here's my module: public class NancySimpleWebModule : NancyModule { ///

filter invalid values in json string

假装没事ソ 提交于 2019-12-11 08:03:50
问题 I'm getting a string in a html body that I am trying to process into valid json. The string I receive isn't a valid json string and contains the following schema: äÄ "key1": " 10", "key2": "beigef}gtem Zahlschein", "key3": " G E L \ S C H T", "key4": "M}nchen", "key5": "M{rz", "key6": "[huus" Ü ä I've written a function to replace all the faulty characters to create a valid json-string, but how do i do the reverse without destroying the letters needed in json? This is how I replaced the