Questions tagged [machinekey]

143 questions
7
votes
2 answers

Unable to validate data error with machine key set to SHA1

I have a simple .net application using the .NET 2.0 runtime in IIS 7.5 where I've changed the machine key in the web.config to use the following:
Ben
  • 784
  • 3
  • 12
  • 32
6
votes
1 answer

Encrypt and decrypt with MachineKey in C#

I'm trying to encrypt and decrypt Id with MachineKey. Here is my code that calls the encrypt and decrypt functions: var encryptedId = Encryption.Protect(profileId.ToString(), UserId); var decryptedId = Encryption.UnProtect(encryptedId,…
Bryan
  • 3,421
  • 8
  • 37
  • 77
6
votes
1 answer

How to decrypt cookie with nodejs

I am trying to make run this function hex2a(hex) { var str = ''; for (var i = 0; i < hex.length; i += 2) str += String.fromCharCode(parseInt(hex.substr(i, 2), 16)); return str; } //Raw cookie var cookie =…
asdf_enel_hak
  • 7,474
  • 5
  • 42
  • 84
5
votes
1 answer

Automatic machine key generation in ASP.NET

By default, the machine key setting is auto generate and per application (AutoGenerate,IsolateApps). MSDN states that the decryption key and validation key is based on web application id. I am hosting two ASP.NET MVC 2 sites on my IIS 7 server but…
intangible02
  • 993
  • 1
  • 9
  • 19
5
votes
2 answers

"Unable to validate data" using FormsAuthentication between different web apps

I have two .NET web applications running on the same server - sentinel (hosted at https://sentinel.mydomain.com/) and fortknox (at http://www.mydomain.com/fortknox) Sentinel is an authentication 'portal'. FortKnox is a 'proof of concept' app that…
Dylan Beattie
  • 53,688
  • 35
  • 128
  • 197
4
votes
1 answer

Where is machineKey/validationKey used in FormsAuthentication?

MSDN : machineKey Configures algorithms and keys to use for encryption, decryption, and validation of forms-authentication data and view-state data, and for out-of-process session state identification Specifically which methods in…
kenwarner
  • 28,650
  • 28
  • 130
  • 173
4
votes
1 answer

Web Api Token Expiration Error

I'm junior in Web api development. I have implemented token-based authentication to my web api project. I have set token expire time with 14 days. OAuthOptions = new OAuthAuthorizationServerOptions { TokenEndpointPath = new…
4
votes
1 answer

Setting MachineKey via app settings

We have an .NET 4.5.x oss application that we are deploying to azure websites using git deploy. We have a build server that commits the artifacts to a git repo and then we use it to git deploy. We use app settings in azure to control everything.…
Blake Niemyjski
  • 3,432
  • 3
  • 25
  • 41
4
votes
0 answers

How do I set the machineKey for a Cloud Service running in Azure?

I am testing the scale-out capabilities of our Azure Cloud Service by moving from one running instance to three. We are using Standard_A2 nodes, a WorkerRole and SignalR for Client-Server connections. After doing this, any inbound SignalR…
KeithSohl
  • 41
  • 3
4
votes
2 answers

Encryption with MachineKey is not persistent

I use the MachineKey.Protect() method to encrypt the id passed as a query string in my asp.net MVC application. Here's the code I use to encrypt/decrypt: public static string Encrypt(this string expression) { if…
ataravati
  • 8,891
  • 9
  • 57
  • 89
4
votes
3 answers

The anti-forgery token could not be decrypted even in localhost?

Even though I am running in localhost, my mvc web site gives me this error: The anti-forgery token could not be decrypted. If this application is hosted by a Web Farm or cluster, ensure that all machines are running the same version of ASP.NET Web…
Ace Supriatna
  • 235
  • 1
  • 4
  • 19
4
votes
1 answer

Is it possible to set a machinekey for an Azure Worker Role

I have hosted an Owin WebAPI Server in an Azure Worker Role. The Owin Authentication middleware seems to use the MachineKey to encrypt and generate Tokens. This works perfectly when I have only one instance of this role, but as soon as I want to use…
4
votes
3 answers

ASP Website does not seem to use machineKey in Web.Config for FormsAuthentication.Decrypt

I want to pass the authentication cookie from my ASP.Net MVC 5 (.Net 4.5.1, hosted locally on iisexpress, run from Visual Studio) to my WCF Service (.Net 4.5.1, hosted locally on WcfSvcHost, run from same Visual Studio Solution) and decrypt it…
wertzui
  • 5,148
  • 3
  • 31
  • 51
4
votes
1 answer

With Azure auto-scaling do I need to specify a MachineKey in web.config?

For a ASP.NET MVC project I worked on recently it was deployed to multiple server instances and required to have a machinekey configured. I have another project which will be deployed onto Azure (Web site standard) and I'm not sure if Azure…
Steve
  • 159
  • 6
4
votes
1 answer

Getting current MachineKey, or equivilent, for HMAC (in web-farm)

I am using HMACSHA256 for message authentication in a web-farm environment. Within the web-farm each machine has the same machine key, so the ViewState will work across machines, however, I need to do HMAC message authentication which will work…
Matthew
  • 24,703
  • 9
  • 76
  • 110
1
2
3
9 10