asp.net


Accessing X509CertificateStore from Server Machine


I want to load a certificate from my certificate store (Local Machine\My store).
I am getting an error as access violation. I tried by opening the Visual studio as administrator then also same tried it but it didn't worked.
On my Local Machine its working fine. But when i host it to server it created access violation. I cannot give all rights to app pool user.
// In For Each loop storeNew.certificates its breaking up and i can see the
// access violation [store.certificates throw ac exception of
//System.AccessViolation]
private void Certificate(string cert)
{
X509CertificateStore storeNew = new X509CertificateStore(X509CertificateStore.StoreProvider.System, X509CertificateStore.StoreLocation.LocalMachine, "My");
int countdown = 2;
do
{
bool open = storeNew.OpenRead();
foreach (Microsoft.Web.Services.Security.X509.X509Certificate certificate in storeNew.Certificates)
{
if (certificate.Subject.ToUpper().Contains("CN=" + certName.ToUpper()))
{
_certificate = certificate;
break;
}
}
storeNew = new X509CertificateStore(X509CertificateStore.StoreProvider.System, X509CertificateStore.StoreLocation.CurrentUser, "My");
} while (countdown > 0 && _certificate == null);
}

Related Links

ASP.NET MVC: on button click, call display multiple ActionResults in different windows
How to have a route that goes to 2 destinations
Displaying PartialView when user enters text? Like an Autocomplete feature?
Looping through my CheckBoxList only inserts one record
How to Configure Test Deployment with the file LocalTestRun.testrunconfig?
ASP.Net MVC 3 ListBox Selected Items Collection Null
The state information is invalid for this page and might be corrupted
Global Code segment in MVC View giving an error… “Expression Expected.”
Is Forms Authentication totally necessary?
inline code on server control properties
manipulating the date and time from a datetime sql server type in vb.net
Multiple users assigned same session ID at once
Click anywhere on a GridView row to enter the edit mode
How to bind all the rows of Dataset in gridview
How to remove Column in crystal report if Column value have NULL
Minify CSS and JS in Asp.Net when Publish a WebApplication

Categories

HOME
pact
repository
system-calls
sql-server-2014
ssh
liquibase
reference
mingw
ms-access-2010
open-search-server
genexus
obd-ii
jpql
expo
logstash-configuration
web-testing
k-means
ibatis
geography
aws-devicefarm
spring-webflow
summernote
datasource
cherrypy
serenity-js
google-drive-android-api
grunt-contrib-uglify
oracle10g
jopendocument
cloudformation
libxml2
custom-fields
federated
selenium3
drawrect
textview
loopback
webmock
repeat
stochastic-process
kepserverex
instances
origami
observer-pattern
ng-lightning
sknode
delphi-xe
apiman
serverless-architecture
text-formatting
lucee
google-cloud-shell
playframework-2.3
openpgp.js
r-commander
liferay-ide
try-catch-finally
dynatable
wicketstuff
acceleo
msiexec
vertex-shader
spring-social-twitter
firebase-job-dispatcher
optional-parameters
android-tabs
airwatch
vitamio
database-administration
mod
radar-chart
ideavim
web-performance
computability
taverna
musicbrainz
httpmodule
pymol
sony-xperia
method-overloading
javadb
famous-engine
formbuilder
pytz
mdp
autofilter
maven-javadoc-plugin
leap-year
codeigniter-form-helper
spawn
esi
report-viewer2010
custom-cursor
states
reflexil
optimistic-concurrency
rjs
vectorwise
jqtransform
chars
carbon-emacs
jgrowl
stackless

Resources

Encrypt Message