asp.net-4.5

Why is my ClaimsIdentity IsAuthenticated always false (for web api Authorize filter)?

那年仲夏 提交于 2019-12-17 10:31:31
问题 In a Web API project I am overriding the normal authentication process to check tokens instead. The code looks something like this: if ( true ) // validate the token or whatever here { var claims = new List<Claim>(); claims.Add( new Claim( ClaimTypes.Name, "MyUser" ) ); claims.Add( new Claim( ClaimTypes.NameIdentifier, "MyUserID" ) ); claims.Add( new Claim( ClaimTypes.Role, "MyRole" ) ); var claimsIdentity = new ClaimsIdentity( claims ); var principal = new ClaimsPrincipal( new[] {

ASP.NET MVC Deployed application can't find views (HTTP 403)

可紊 提交于 2019-12-13 03:43:39
问题 I am attempting to deploy the first MVC application to an existing production server. The application works in Visual Studio debug mode, but on the server, if I try to call up my home path I get an HTTP 403 error unless I enable directory browsing in IIS, in which case I see the contents of the directory, as you might expect. The server is running Windows Server 2008 and is on the same domain as my development computer. What I have tried so far: Verified that .NET framework 4.5 has been

ASP.NET 4.5 Membership and oAuth Tables

依然范特西╮ 提交于 2019-12-13 00:50:22
问题 Does anyone know how i can get the oAuth part on the ASP.NET membership moved to my MS SQL DB, rather than use localdb which its seems to be doing by default? I have my users all set up in my SQL db, however the UsersOpenAuthAccounts and UsersOpenAuthData are stored in a localdb. I am using ASP.NET 4.5, not the MVC framework... just incase that helps. Update: When i change my connection string to "DefaultConnection" the oAuth" tables are then created in my DB. I suppose this will do. But how

Page.AsyncTimeout - endless timeout?

元气小坏坏 提交于 2019-12-12 14:37:11
问题 I saw an example of forever iframe implementation ( comet simulation ) , so I decided to test it but with the addition of asynchronous approach , so that there will be no blocking. Pretty simple : I have a page ( index.html ) with hidden iframe which has SRC of AdminPush.aspx : /*1*/ protected void Page_Load(object sender, EventArgs e) /*2*/ { /*3*/ UpdateMessage(); /*4*/ } /*5*/ /*6*/ /*7*/ protected void UpdateMessage() /*8*/ { /*9*/ HttpContext.Current.Response.ContentType = "text/html"; /

Unable to connect to SQL Server database

佐手、 提交于 2019-12-12 10:39:49
问题 I'm creating a web application in mvc 4.0 and I need to enable Membership and Authorization using Asp.netWeb Site Administration Tool but when I clicks the security tab it gives me an error There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store. The

.NET 4.5 WebForms: do I (still) really have to specify all 3 templates in a FormView?

帅比萌擦擦* 提交于 2019-12-12 08:06:24
问题 Investigating the new strongly-typed, model-binding approach within ASP.NET 4.5 WebForms: In Scott Hanselman's example of WebForms model binding (amongst others) I've seen the use of a FormView that opens in "Edit" mode, containing a number of DynamicControls e.g. <asp:FormView runat="server" ID="MyForm" ... DefaultMode="Edit"> <EditItemTemplate> <asp:DynamicControl runat="server" ID="Field1" DataField="Field1" Mode="Edit" /> <asp:DynamicControl runat="server" ID="Field2" DataField="Field2"

Signalr example app from official documentation does not work on IIS

痞子三分冷 提交于 2019-12-12 03:47:03
问题 I've spent too much time trying to figure this out, and I'm starting to exhaust the threads here on SO that are dealing with this very issue. Feel free to link to other threads about this issue, but I've probably already consulted those with no success. I'm following Microsoft's Signalr example app from this url: https://docs.microsoft.com/en-us/aspnet/signalr/overview/getting-started/tutorial-getting-started-with-signalr I'm running IIS 8.5 on Windows Server 2012 R2, SignalR 2.2.1, and .Net

EF6 with new database generates 'The model backing the <Database> context has changed since the database was created.'

折月煮酒 提交于 2019-12-12 00:50:47
问题 I have been developing a Code First database via migrations for a couple of weeks. I added a few tables yesterday and got the error The model backing the 'DanceDb' context has changed since the database was created. After trying a couple of things I dropped the database, removed all code migrations, cleaned the solution, added a single migration and ran an Update-Database but I still get the same error. If I run Add-Migrations again, nothing is generated so something thinks they're the same.

Lost access to HTTP Request after upgrade to .NET Framework 4.5

别等时光非礼了梦想. 提交于 2019-12-11 18:07:18
问题 I have a WCF service that accepts a POST request from jqGrid in the form of HTML form and returns JSON. While things were on .NET 4.0, all worked fine. I could access form fields inside the service via request["fieldName"] . Once I upgraded to .NET 4.5, all my request["fieldName"] are now blank. Is there some kind of known issue with .NET 4.5, WCF and HttpContext.Current.Request ? Here is an example: POST http://{REMOVED}/Grid.svc/Execute HTTP/1.1 Accept: application/json, text/javascript, */

How can I add and remove authorised users from web.config location path in asp.net

久未见 提交于 2019-12-11 16:23:33
问题 I am trying to add and remove authorised users from web.config programmatically. I am using Windows Authentication. This is what I have on web.config <location path="Admin"> <system.web> <authorization> <allow users="domain\user1, domain\user2"/> <deny users="*"/> </authorization> </system.web> </location> Now in the code I have the following code. protected void UpdateUsers() { System.Configuration.Configuration config = (Configuration)WebConfigurationManager.OpenWebConfiguration("~");