Questions tagged [owin]
Open Web Interface for .NET that describes how components in a HTTP pipeline should communicate.
owin
4,625
questions
402
votes
22
answers
127k
views
OwinStartup not firing
I had the OwinStartup configuration code working perfectly and then it stopped working. Unfortunately I'm not sure exactly what I did to get it to stop working and am having a really hard time ...
353
votes
4
answers
72k
views
How to explain Katana and OWIN in simple words and uses?
I have read many articles about the OWIN and Katana projects, but I could not get the whole picture of it.
For a normal web developer who uses ASP.NET:
What exactly is OWIN and what problems does ...
272
votes
5
answers
72k
views
When should I use OWIN Katana?
I am new to OWIN and Katana. I really don't get why I should use OWIN, while I can use IIS. To simplify, my question is: What do I lose if I skip learning OWIN and use IIS for my websites?
I googled ...
233
votes
19
answers
295k
views
OWIN Startup Class Missing
I'm getting this error as my project is not able to find the reference for OWIN startup class. I've even installed all the OWIN reference packages through Nuget still getting the same issue. I'm using ...
218
votes
3
answers
81k
views
Do I need a Global.asax.cs file at all if I'm using an OWIN Startup.cs class and move all configuration there?
Let's say for example in a brand new ASP.NET MVC 5 application made from the MVC with Individual Accounts template, if I delete the Global.asax.cs class and move it's configuration code to Startup.cs ...
191
votes
4
answers
153k
views
Adding ASP.NET MVC5 Identity Authentication to an existing project
I have seen lots of similar pages on the web, but most of them use a new project instead of an existing one, or don't have the necessary features. So, I have an existing MVC 5 project and want to ...
189
votes
15
answers
106k
views
Unauthorised webapi call returning login page rather than 401
How do I configure my mvc/webapi project so that a webapi method called from a razor view doesn't return the loginpage when its unauthorised?
Its a MVC5 application which also has WebApi controllers ...
171
votes
9
answers
101k
views
ASP.NET_SessionId + OWIN Cookies do not send to browser
I have a strange problem with using Owin cookie authentication.
When I start my IIS server authentication works perfectly fine on IE/Firefox and Chrome.
I started doing some testing with ...
113
votes
13
answers
97k
views
Can't find Request.GetOwinContext
I have been searching for an hour trying to figure out why this isn't working.
I have a ASP.Net MVC 5 application with a WebAPI. I am trying to get Request.GetOwinContext().Authentication, however I ...
109
votes
23
answers
175k
views
No assembly found containing an OwinStartupAttribute Error
This error
The following errors occurred while attempting to load the app.
- No assembly found containing an OwinStartupAttribute.
- The given type or method 'false' was not found. Try specifying ...
90
votes
10
answers
218k
views
Getting "error": "unsupported_grant_type" when trying to get a JWT by calling an OWIN OAuth secured Web Api via Postman
I have followed this article to implement an OAuth Authorization server. However when I use post man to get a token, I get an error in the response:
"error": "unsupported_grant_type"
I read ...
85
votes
4
answers
131k
views
OWIN Security - How to Implement OAuth2 Refresh Tokens
I am using the Web Api 2 template that comes with Visual Studio 2013 has some OWIN middleware to do User Authentication and the likes of.
In the OAuthAuthorizationServerOptions I noticed that the ...
79
votes
7
answers
40k
views
Error renaming ASP.NET MVC project
I have copied a previous project and renamed it. Once I had successfully renamed all the name spaces and it build correctly. I got the following error when I ran the application:
The following errors ...
77
votes
9
answers
71k
views
The type or namespace IAppBuilder could not be found(missing using a directive pr an assembly reference)
I am working on an Asp.Net MVC 4 Application in which I am using SignalR 2.0.1 and I Mapped it using Owin Startup class and it worked fine at first.
All of a sudden when I tried to rebuild my app it ...
76
votes
11
answers
66k
views
Object reference not set to an instance of an object in _Layout.cshtml after updated packages
The project was running fine until I updated all NuGet packages via
NuGet Manager (I was trying to get the latest OWIN packages).
This error is in the _Layout.cshtml and I have not touched it at all.
...
75
votes
1
answer
28k
views
Registering Web API 2 external logins from multiple API clients with OWIN Identity
I would like the following architecture (I've made up the product name for this example):
Web API 2 application running on one server
http://api.prettypictures.com
MVC 5 client app running on ...
74
votes
9
answers
49k
views
No OWIN authentication manager is associated with the request
After trying to enable owin & AspNet Identity to my Web Api project (in VS 2013 + .Net 4.5.1) I get the following error in each valid or unvalid(request to none exist controller) requests :
<...
74
votes
2
answers
38k
views
Using bearer tokens and cookie authentication together
I have a single page app - more or less based on the MVC5 SPA template - using bearer tokens for authentication.
The site also has a couple of conventional MVC pages which need to be secured, but ...
72
votes
4
answers
34k
views
OWIN HttpListener not located
When I try to start :
WebApp.Start<SrvcHst>(new StartOptions { Port = 9956,
ServerFactory = "Microsoft.Owin.Host.HttpListener" });
I get the following exception. What could be the root ...
70
votes
5
answers
36k
views
The server factory could not be located for the given input: Microsoft.Owin.Host.HttpListener
I have implemente signalR in window service.
private IDisposable SignalR { get; set; }
public void Configuration(IAppBuilder app)
{
var hubconfig=new Microsoft.AspNet.SignalR....
70
votes
3
answers
71k
views
Can't get UserManager from OwinContext in apicontroller
I'm following a Microsoft sample to implement email validation with Identity 2.0.0
I'm stuck at this part
public ApplicationUserManager UserManager
{
get
{
return _userManager ?? ...
69
votes
8
answers
15k
views
Owin Twitter login - the remote certificate is invalid according to the validation procedure
I started getting this error recently when trying to login using twitter- any idea why?
Stack Trace:
[AuthenticationException: The remote certificate is invalid according to the validation ...
69
votes
17
answers
28k
views
OWIN's GetExternalLoginInfoAsync Always Returns null
I've created a new MVC5 Web Application, and when I try to login with Google or Facebook, the ExternalLoginCallback Action in the AccountController is called, but GetExternalLoginInfoAsync() always ...
69
votes
5
answers
50k
views
How to change type of id in Microsoft.AspNet.Identity.EntityFramework.IdentityUser
(ASP.NET MVC 5, EF6, VS2013)
I'm trying to figure out how to change the type of the "Id" field from string to int in the type:
Microsoft.AspNet.Identity.EntityFramework.IdentityUser
in order to ...
69
votes
3
answers
56k
views
How to use DI container when OwinStartup
It's a Web API 2 project.
When I implement DI using Ninject, I got an error message
An error occurred when trying to create a controller of type 'TokenController'. Make sure that the controller has ...
67
votes
11
answers
25k
views
ASP.NET MVC5 OWIN Facebook authentication suddenly not working
Update 2017!
The issue I had when I posted the original question has got nothing to do with the recent changes Facebook made when they forced everyone to version 2.3 of their API. For a solution to ...
64
votes
3
answers
50k
views
Return more info to the client using OAuth Bearer Tokens Generation and Owin in WebApi
I have created a WebApi and a Cordova application.
I am using HTTP requests to communicate between the Cordova application and the WebAPI.
In the WebAPI, I've implemented OAuth Bearer Token Generation....
64
votes
4
answers
34k
views
How are bearer tokens stored server-side in Web API 2?
I am setting up bearer token authentication in Web API 2, and I don't understand how (or where) the bearer token is being stored server-side. Here is the relevant code:
Startup:
public partial class ...
63
votes
1
answer
33k
views
How do I get System.Web.Http.Owin?
I had a version number problem with system.web.http.owin.
So I removed it from my projects package references, with the idea that I would re-added it to see if it fixed the problem. However it has ...
60
votes
4
answers
14k
views
Distinction between Kestrel and Katana
My understanding is currently you can self host WebAPI using Katana, and MVC will have this capability in a future version. Essentially Katana will be a hosting option available to both MVC and WebAPI....
55
votes
3
answers
55k
views
What is the new Startup.cs file for in Visual Studio 2013 projects?
I have just installed Visual Studio 2013, created an MVC Web Application project and noticed a new file in the project template called Startup.cs.
What is this, how is this different from Global.asax....
54
votes
3
answers
24k
views
What is the purpose of the extension method CreatePerOwinContext in OWIN implementation by Microsoft
I am a newbie in ASP.NET, and currently learning ASP.NET Identity. I know it's built on top of OWIN implementation by Microsoft, and I am also still learning that too. So, I came across the extension ...
53
votes
6
answers
28k
views
Context.User.Identity.Name is null with SignalR 2.X.X. How to fix it?
This is driving me insane.
I'm using latest signalR release (2.0.2). This is my hub code (OnConnected)
public override Task OnConnected()
{
//User is null then Identity ...
52
votes
2
answers
32k
views
UseCookieAuthentication vs. UseExternalSignInCookie
I use Owin to authorize through Google oAuth. Here is how my cookies are configured:
// Enable the application to use a cookie to store information for the signed in user
app.UseCookieAuthentication(...
52
votes
3
answers
38k
views
IHttpActionResult and helper methods in ASP.NET Core
I'm trying to move my web api 2 project to ASP.NET 5.
But I have many elements that are not present anymore.
For example IHttpActionResult or Ok(), NotFound() methods.
Or RoutePrefix[]
Should I ...
52
votes
1
answer
23k
views
UseOAuthBearerTokens vs UseOAuthBearerAuthentication
In our Startup class, I have configured the following auth server options:
OAuthAuthorizationServerOptions OAuthServerOptions = new OAuthAuthorizationServerOptions()
{
AllowInsecureHttp = true,
...
52
votes
3
answers
41k
views
Running self-hosted OWIN Web API under non-admin account
Is it possible for a self-hosted OWIN Web API to run under a non-administrator account? I have already tried dozens of url reservations and nothing works. The service fails to start with "Access is ...
51
votes
16
answers
18k
views
Why is [Owin] throwing a null exception on new project?
I have a rather strange issue i'm not sure how to fix or if i can even fix it.
I've done some research into the issue but can't find an answer to what's causing it.
I'm following a rather simple ...
50
votes
2
answers
13k
views
Hw to pass arguments to my own Startup class?
I'm trying to develop a web api self hosting app using OWIN.
In my own XyzStartup class, I need an external argument: contentFolderPath.
However, I didn't find a way to pass this argument. Here is my ...
50
votes
2
answers
800
views
Translate ninject ISecureDataFormat binding to Autofac
I am migrating a large codebase from Ninject to Autofac and am struggling on one of the bindings that I believe is causing an activation error based on some of my debugging.
Ninject:
Bind<...
49
votes
1
answer
88k
views
How do you login/authenticate a user with Asp.Net MVC5 RTM bits using AspNet.Identity?
I have been working on a web application using MVC5, EF6, and VS 2013.
I spent some time upgrading to the RC bits once released. Thanks to all the great posts out there: eg. Decoupling Microsoft....
48
votes
5
answers
78k
views
ASP.NET (OWIN) Identity: How to get UserID from a Web API controller?
(Using VS2013 RTW, ASP.NET MVC5)
I've seen lots of documentation on how to add properties to the ApplicationUser class (and table) when using ASP.NET identity. But I haven't seen any documentation on ...
48
votes
6
answers
52k
views
Hosting WebAPI using OWIN in a windows service
I've self-hosted Web API using OWIN (inside a windows service). From what I understand, this is enough to make HTTP requests come to the windows service. I'm able to hit the WebAPI URL (http://...
48
votes
2
answers
24k
views
What is the relationship between owin and oAuth2.0?
I study external login strategies and the terminology confuses me. What's the relation between the following.
Owin
OauthWebSecurity
OAuth 2.0
Owin Katana
ASP.NET Identity
47
votes
8
answers
24k
views
MVC 5 How to define Owin LoginPath with localized routes
I have a MVC 5 website with localized routes defined as
routes.MapRoute(
name: "Default",
url: "{culture}/{controller}/{action}/{id}",
defaults: new { culture = ...
47
votes
3
answers
46k
views
Add Custom Claim Types
New to OWIN authentication and finding it hard to create my own owin claim types.
Heres the thing. I need to add custom claims like "GroupID" so i can easily access it on the different pages.
I did ...
47
votes
5
answers
9k
views
Disable *all* exception handling in ASP.NET Web API 2 (to make room for my own)?
I want to wire up exception handling in a middleware component, something like this:
public override async Task Invoke(IOwinContext context)
{
try
{
await Next.Invoke(context);
}
...
46
votes
2
answers
4k
views
Why middleware in ASP.NET Core requires specific semantics, but not an interface?
As known, IApplicationBuilder of the method Configure (class Startup) in ASP.NET Core requires specific semantics (to have method 'Invoke' with input parameter of HttpContext type and Task as return ...
45
votes
3
answers
14k
views
In self-hosted OWIN Web API, how to run code at shutdown?
I am self-hosting a OWIN Web API using these code snippets:
class Startup
{
public void Configuration(IAppBuilder appBuilder)
{
var config = new HttpConfiguration();
var route ...
45
votes
4
answers
33k
views
How IsPersistent works in OWIN Cookie authentication
It seems I don't understand clearly how IsPersistent in OWIN cookie authentication works, the code below is to use IsPersistent:
var context = Request.GetOwinContext();
var authManager = context....