本文整理汇总了C#中IAppBuilder.UseWelcomePage方法的典型用法代码示例。如果您正苦于以下问题:C# IAppBuilder.UseWelcomePage方法的具体用法?C# IAppBuilder.UseWelcomePage怎么用?C# IAppBuilder.UseWelcomePage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IAppBuilder
的用法示例。
在下文中一共展示了IAppBuilder.UseWelcomePage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Configuration
public void Configuration(IAppBuilder app)
{
#if DEBUG
app.UseErrorPage();
#endif
app.UseWelcomePage("/");
}
示例2: Configuration
public void Configuration(IAppBuilder app)
{
/* // Note: Enable only for debugging. This slows down the perf tests.
app.Use((context, next) =>
{
var req = context.Request;
context.TraceOutput.WriteLine("{0} {1}{2} {3}", req.Method, req.PathBase, req.Path, req.QueryString);
return next();
});*/
app.UseErrorPage(new ErrorPageOptions { SourceCodeLineCount = 20 });
// app.Use(typeof(AutoTuneMiddleware), app.Properties["Microsoft.Owin.Host.HttpListener.OwinHttpListener"]);
app.UseSendFileFallback();
app.Use<CanonicalRequestPatterns>();
app.UseStaticFiles(new StaticFileOptions()
{
RequestPath = new PathString("/static"),
FileSystem = new PhysicalFileSystem("public")
});
app.UseDirectoryBrowser(new DirectoryBrowserOptions()
{
RequestPath = new PathString("/static"),
FileSystem = new PhysicalFileSystem("public")
});
app.UseStageMarker(PipelineStage.MapHandler);
FileServerOptions options = new FileServerOptions();
options.EnableDirectoryBrowsing = true;
options.StaticFileOptions.ServeUnknownFileTypes = true;
app.UseWelcomePage("/Welcome");
}
示例3: Configuration
public void Configuration(IAppBuilder app)
{
app.UseWelcomePage(new PathString("/Welcome"));
app.UseFileServer(new FileServerOptions
{
EnableDirectoryBrowsing = false,
FileSystem = new PhysicalFileSystem(@"..\..\..\KatanaApp\StaticResources"),
RequestPath = new PathString(@"/contents")
});
app.Run(ctx =>
{
if (string.IsNullOrEmpty(ctx.Request.Path.Value) || ctx.Request.Path.Value == "/" || ctx.Request.Path.Value == "/Welcome/")
{
ctx.Response.Redirect("/app/Welcome");
}
// New code: Throw an exception for this URI path.
if (ctx.Request.Path.Value == @"/fail")
{
throw new HttpException(500, "Random exception");
}
ctx.Response.ContentType = "text/plain";
return ctx.Response.WriteAsync("Hello World!");
});
}
示例4: Configuration
public void Configuration(IAppBuilder app)
{
#if DEBUG
app.UseErrorPage();
#endif
app.UseWelcomePage(new Microsoft.Owin.Diagnostics.WelcomePageOptions()
{
Path = new PathString("/welcome")
});
app.Run(context =>
{
context.Response.ContentType = "text/html";
string output = string.Format(
"<p>I'm running on {0} </p><p>From assembly {1}</p>",
Environment.OSVersion,
System.Reflection.Assembly.GetEntryAssembly().FullName
);
return context.Response.WriteAsync(output);
});
}
示例5: Configuration
public void Configuration(IAppBuilder app)
{
#if DEBUG
app.UseErrorPage(new ErrorPageOptions
{
//Shows the OWIN environment dictionary keys and values.
//This detail is enabled by default if you are running your app from VS unless disabled in code.
ShowEnvironment = true,
//Hides cookie details
ShowCookies = true,
//Shows the lines of code throwing this exception.
//This detail is enabled by default if you are running your app from VS unless disabled in code.
ShowSourceCode = true
});
//for test ErrorPage
//app.Run(async context =>
//{
// throw new Exception("UseErrorPage() demo");
// await context.Response.WriteAsync("Error page demo");
//});
app.UseWelcomePage("/"); // for test purpose only
#endif
ConfigureOAuth(app);
var config = new HttpConfiguration();
WebApiConfig.Register(config);
app.UseCors(Microsoft.Owin.Cors.CorsOptions.AllowAll);
app.UseWebApi(config);
}
示例6: Configuration
public void Configuration(IAppBuilder app)
{
// Show an error page
app.UseErrorPage();
// Logging component
app.Use<LoggingComponent>();
// Configure web api routing
var config = new HttpConfiguration();
config.MapHttpAttributeRoutes();
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
// Use web api middleware
app.UseWebApi(config);
// Throw an exception
app.Use(async (context, next) =>
{
if (context.Request.Path.ToString() == "/fail")
throw new Exception("Doh!");
await next();
});
// Welcome page
app.UseWelcomePage("/");
}
示例7: Configuration
public void Configuration(IAppBuilder app)
{
// from Owin.Diagnostics
app.UseWelcomePage();
// low level app.Run
//app.Run(ctx =>
//{
// foreach (var kvp in ctx.Environment)
// {
// Console.WriteLine("{0}:{1}", kvp.Key, kvp.Value);
// }
// return ctx.Response.WriteAsync("Hello!");
//});
// Synch Handler
// app.UseHandler((request, response) =>
// {
// response.Write("Hello!");
// });
// Asynch handler
//app.UseHandlerAsync((request, response) =>
//{
// response.ContentType = "text/plain";
// return response.WriteAsync("Hello!");
//});
}
示例8: Configuration
public void Configuration(IAppBuilder app)
{
ConfigureStaticFileServer(app);
ConfigureWebApi(app);
// Anything not handled will land at the welcome page.
app.UseWelcomePage();
}
示例9: Configuration
public void Configuration(IAppBuilder app)
{
#if DEBUG
app.UseErrorPage();
#endif
// Remap '/' to '.\defaults\'.
// Turns on static files and default files.
app.UseFileServer(new FileServerOptions()
{
RequestPath = PathString.Empty,
FileSystem = new PhysicalFileSystem(@".\defaults"),
});
// Only serve files requested by name.
app.UseStaticFiles("/files");
// Turns on static files, directory browsing, and default files.
app.UseFileServer(new FileServerOptions()
{
RequestPath = new PathString("/public"),
EnableDirectoryBrowsing = true,
});
// Browse the root of your application (but do not serve the files).
// NOTE: Avoid serving static files from the root of your application or bin folder,
// it allows people to download your application binaries, config files, etc..
app.UseDirectoryBrowser(new DirectoryBrowserOptions()
{
RequestPath = new PathString("/src"),
FileSystem = new PhysicalFileSystem(@""),
});
// Anything not handled will land at the welcome page.
app.UseWelcomePage();
}
示例10: Configuration
public void Configuration(IAppBuilder app)
{
app.Frameguard(XFrameOptions.Deny);
app.XssFilter(true);
app.NoSniff();
app.IENoOpen();
app.UseWelcomePage();
}
示例11: Configuration
public void Configuration(IAppBuilder app)
{
// Microsoft.Owin.Diagnostics allows for these guys:
#if DEBUG
app.UseErrorPage();
#endif
app.UseWelcomePage("/");
}
示例12: Configuration
public void Configuration(IAppBuilder app)
{
app.UseElmoMemoryLog();
app.UseElmoViewer();
//app.UseErrorPage();
app.UseWelcomePage("/");
app.Use(DoSomething);
}
示例13: Configuration
public void Configuration(IAppBuilder app)
{
#if DEBUG
app.UseErrorPage();
#endif
app.UseWelcomePage("/welcome");
app.Use(async (ctx, next) =>
{
Debug.WriteLine("IN - [{0}] {1}{2}", ctx.Request.Method, ctx.Request.Path, ctx.Request.QueryString);
await next();
if (ctx.IsHtmlResponse()) await ctx.Response.WriteAsync("Added at bottom will be moved into body by good browser");
Debug.WriteLine("OUT - " + ctx.Response.ContentLength);
});
app.UseDebugMiddleware(new DebugMiddlewareOptions
{
OnIncomingRequest = ctx =>
{
var watch = new Stopwatch();
watch.Start();
ctx.Environment["DebugStopwatch"] = watch;
},
OnOutgoingRequest = ctx =>
{
var watch = (Stopwatch)ctx.Environment["DebugStopwatch"];
watch.Stop();
Debug.WriteLine("Request took: " + watch.ElapsedMilliseconds + " ms");
}
});
app.Map("/mapped", map => map.Run(ctx =>
{
ctx.Response.ContentType = "text/html";
return ctx.Response.WriteAsync("<html><body>mapped</body></html>");
}));
//app.UseBeanMiddleware();
//app.Use(async (ctx, next) =>
//{
// if (ctx.Authentication.User != null &&
// ctx.Authentication.User.Identity != null &&
// ctx.Authentication.User.Identity.IsAuthenticated)
// {
// await next();
// }
// else
// {
// ctx.Authentication.Challenge(AuthenticationTypes.Federation);
// }
//});
app.UseCornifyMiddleware(new CornifyMiddlewareOptions { Autostart = false });
app.UseKonamiCodeMiddleware(new KonamiCodeMiddlewareOptions { Action = "setInterval(function(){ cornify_add(); },500);" });
app.UseServeDirectoryMiddleware();
}
示例14: Configuration
public void Configuration(IAppBuilder appBuilder)
{
HttpConfiguration config = new HttpConfiguration();
WebApiConfig.Register(config);
appBuilder.UseWebApi(config);
config.Formatters[0] = new JsonStringMediaTypeFormatter();
appBuilder.UseErrorPage();
appBuilder.UseWelcomePage("/");
}
示例15: Configuration
public void Configuration(IAppBuilder app)
{
app.UseWelcomePage();
//TODO: LLegamos hasta The AppFunc del curso "ASP.NET MVC 5 Fundamentals" http://pluralsight.com/training/Player?author=scott-allen&name=aspdotnet-mvc5-fundamentals-m3-identity&mode=live&clip=0&course=aspdotnet-mvc5-fundamentals
//app.Run(ctx =>
//{
// return ctx.Response.WriteAsync("Hello World!");
//});
}