C# - Private Key Does Not Persist Even With X509KeyStorageFlags.PersistKeySet

Dec 9, 2010

I am storing a key pair in Windows Store, and recently started receiving the "Keyset does not exist" error. Investigating a bit further i found out it could be two things, 1 - The private key is not stored with the persist key set attribute (X509KeyStorageFlags.PersistKeySet) and 2 - access rights to the key. I have tried both 1 and 2 with no success on one machine (in my machine it works apparently). The strange thing is that when i look into MicrosoftCryptoRSAMachineKeys (and S-1-5-18) the key remains there but only for a period of time then it is deleted which means that it is not persisting.

//If decoded then save as RSACryptoServiceProvider
newCert.PrivateKey = DecodePrivateKey(privateKeyFile, pkPassword)
if (newCert.PrivateKey == null)
throw new System.NullReferenceException("Decoded private key resulted in a null reference. Unable to store certificate.");
byte[] pfx = newCert.Export(X509ContentType.Pfx);
newCert = new X509Certificate2(pfx, string.Empty, X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet);

I am running this code on a WCF Service hosted on IIS, and the certificate is deleted even if i give permissions to Network Service, the AppPoolIdentity, my account, etc through MMC-CertMgr. Would anyone know why this happens?

View 1 Replies


Similar Messages:

C# - How To Persist Authentication From One Web App To Another

Feb 18, 2011

So my company has an ASP.NET web app, targeting .NET 3.5. I am tasked with building a ticketing system for them. I don't really need to use any resources of the company app, except for authentication. I would like to target .NET 4.0 and use the 4.0 goodies like entity framework and mvc 3.0. If I create an application targeting .net 4 nested within the main web app in IIS, is there a way to persist authentication so they do not require a different session within the 4.0 web app?

View 2 Replies

C# - Why Need A Private Constructor

Apr 6, 2010

if a class has a private constructor then it cant be instantiated. so, if i dont want my class to be instantiated and still use it, then i can make it static. what is the use of a private constructor? Also its used in singleton class, except that, is there any othe use ? (Note : The reason i am excuding the singleton case above is because I dont understand why do we need a singleton at all ? when there is a static class availble.

View 8 Replies

MVC :: Can DataAnnotations Persist Through Serialization

May 24, 2010

I am using business objects that are accessed via webservices. These objects can be loaded via the webservice and serialized to my mvc app. The mvc app can get a web reference to the objects and they can be utilized in the mvc app. However, the business objects are where the classes are defined, and where the annotations are applied.

The mvc validation seems to have no idea that there are System.ComponentModel.DataAnnotations attributes applied to this business object class.

1) Are DataAnnotations lost when objects are serialized / deserialized?

2) If in mvc I use a view model approach, and have nested objects (which themselves have public properties - decorated with DataAnnotations) can/will the mvc validation system traverse the entire object model, the model being used for my view? (so it can see DataAnnotations attributes of the nested object)?

View 1 Replies

How To Login Via SSL Persist When Switching To Non - SSL

Apr 5, 2010

I have an application I would like to force SSL on the login page and on the page that the CC is entered on. I would prefer to keep the rest of the application free of SSL.

I have the code working to force SSL on certain pages, and remove SSL on others. The problem I have is that if I log in with SSL enabled the user is only authenticated on the pages that are SSL. The reverse holds true as well, if the user logs in without SSL they are only authenticated on pages without SSL.

What can I do to have this persist between the two. Is this using cookies or the session?

View 1 Replies

MVC :: How To Persist Search String

Mar 5, 2011

Site.Master contiains search form using code below. After pressing submit button entered search string is reset since whole page is re-loaded. How to persist search string so that search field contains enterread value after page is re-loaded ?

[Code]....

View 13 Replies

How To Persist Session Values In .Net

Mar 9, 2011

I'm implementing IHttpHandler and IRequiresSessionState and I'm using context.Session but after I set up a value in Session, it's lost in the next request. What can I do to persist the values ?

$.ajax({
url: "/test.test",
type: "POST",
data: "{'type':'GetStep'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) {...}
});


The second call is similar to this, but the values that get set when I call this function are also lost on the next request.

public void ProcessRequest (HttpContext context)
{
context.Session ["Game"] = new Game (); // next time it is null
}

How do I persist values in Session state in ASP.NET ?

View 1 Replies

Persist A Change In A DBML?

Jun 24, 2010

I have a table of users called Users

And a view called UsersActive that filters out deactivated users.

When I create my DBML, I drag the Users table in, then I change the property on the table to point to UsersActive.

This works well, until the DBML gets re-created.

Does anyone know how to fix this?

I've tried overriding the

[Table(Name="dbo.Users")]

attribute in a partial class but get the error:

Duplicate 'Table' attribute

View 1 Replies

Can Use Automapper And Private Members

Mar 23, 2011

Can it handle mapping using private members like NHibernate can? The documentation is very slim, but it seems like one of the objects or methods provided with the tool could do something like this.

Mapper
.With<FooDTO>()
.Map(x => x.Value)
.To<Foo>("_value");
// To<T>(string member) or To<T>(Func<T, bool> func)
Mapper.CreateMap<Foo, FooDTO>();

I know my example methods don't exist as-is, but maybe I've overlooked something else already built in.

View 1 Replies

How To Use Private Messages Module

Nov 2, 2010

I am looking for a ready to use Private Messages for ASP.NET. I am using the default ASP.NET membership.

I googled for days, but cannot find such Private messages module that contains simple features likle Inbox/OutBox, Send PM, Reciebe PMs...and so on...

I have no plan to erite such script. this is a very common requierment for lots of ASP.NET websites.

View 3 Replies

Security :: RSA Private / Public Key

Sep 17, 2010

I have an web application that encrypts data using a public and sent it to another web application. Which will then decrypt the data using a the user private key. My question is, since but the Private and Public key are generated in the first application. how does the other application get the private?

View 2 Replies

Private Function Does Not Working?

Jul 23, 2010

private void Form1_Load(System.Object sender, System.EventArgs e)
{
Dim stri As String
stri ="SELECT allowType fROM SLABS order by allowtype"
this.FillCombo(stri, Cmballowa);
}
private void FillCombo(string ssql, object cbo)
{
SqlDataAdapter da = default(SqlDataAdapter);
SqlConnection con = new SqlConnection();
DataSet ds = null;
DataView dv = null;
con = new SqlConnection(constr);
da = new SqlDataAdapter(ssql, con);
ds = new DataSet();
da.Fill(ds, "ITEM");
dv = ds.Tables("ITEM").DefaultView;
cbo.DataSource = dv;
}

But here some error message is coming in "private FillCombo function" like "'object' does not contain a definition for 'DataSource' and no extension method 'DataSource' accepting a first argument of type 'object' could be found (are you missing a using directive or an assembly reference?)" So, how can i correct this error?

View 1 Replies

How To Persist Page State Across Pages

Mar 24, 2011

I need a way to save and load the Page State in a persistent manner (Session). The Project i need this for is an Intranet Web Application which has several Configuration Pages and some of them need a Confirmation if they are about to be saved. The Confirmation Page has to be a seperate Page. The use of JavaScript is not possible due to limitations i am bound to. This is what i could come up with so far:

[code]....

I can't seem to find a way to load the Page State after being redirected from the Confirmation.aspx to the PageToConfirm.aspx.

View 1 Replies

How To Persist The Data From A Repeater After Postback

Jul 1, 2010

I have a repeater that displays financial data and prices for various stocks.

On this page, I also have an "export" button that needs to take the data ~on the screen~ and convert it into a CSV for the user.

The problem is, after I databind my list of "Stock" entities:

List<Stock> stocks = GetStocks()
rptStockList.DataSource = stocks;
rptStockList.DataBind();

The data is not persisted on postback.

Also, the data on this page is constantly being updated via an UpdatePanel and a Timer control (being re-databound each time). Every 30 seconds the prices displayed for the various stocks in the repeater control change.

Now, I have a linkbutton that has a click event method in the code-behind that is supposed to export the ~data on the screen~ for the user. I need to grab the current values for the list of stocks last databound to the repeater. I can't simply go grab the latest values from the database because those will have been changed in the time between the last refresh.

protected void lbtnExportStocks_Click(object sender, EventArgs e)
{
// No longer have the stock data used in the repeater control
ExportStocksToExcel();
}

I know that ASP.NET doesn't persist the datasource for the repeater on post-back but I need to still be able to either re-construct this list of Stock entities so I can send them the CSV or I need persist it in some way.

I don't want to do anything that is too heavy handed in terms of performance because during certain days of the week this application can have some heavy usage.

What is the proper solution to this type of situation? Should I iterate through the Repeater's "Items" collection and reconstruct the Stock entities?

View 4 Replies

What's Best Way To Persist Login And Password SQL Server - Uses SMO?

Oct 21, 2010

I am creating a simple web management studio using SMO. Is it secure enough to persist/store user information (login and password for database) using ASP.NET mechanism (e.g. formsauthentication, cookies, etc.). What will be the best practice to do this?

View 1 Replies

How To Persist Javascript Changes On The Server Side

Jan 6, 2011

how to persist javascript changes on the server side.For example if I added items to a drop down list client side, how can i persist them in order to read them on the server side.By the way, Telerik control have this feature.

View 2 Replies

C# - How To Persist Graph Data For Website

Nov 1, 2010

We've worked out some of the tasks on our website can be efficiently solved by maintaining the data using a graph structure. But we don't have much of an idea about how the graph is best persisted. Further we want to write and read simultaneously in an efficient manner in out asp.net app so it needs to handle multiple threads. It doesn't need to be super fast but it needs to be scalable to handle potentially millions of nodes.

I don't want to hack my own system and have heard of Neo4j. Lots of Java developers seem to recommend it to one another. Obviously I'm on the .Net platform and prefer to not have to switch.

What are the available options, particularly on the .Net platform?

View 1 Replies

ViewState - How To Persist State Between Two Pages

Feb 16, 2011

On page1.aspx i hava a textbox with id="tb1"
On page2.aspx I have a textbox with id="tb2"

page2.aspx is set as postbackurl for page1.aspx. For both labels enabl;eViewState is true. Shouldn't the text I write in page1 also appear in the label on page2? Can I implement this without looking into Request headers, and setting the text myself?

View 1 Replies

How To Persist A Model Across Multiple Requests In MVC 2

Jan 3, 2011

I'm building a web application that has a particular model representing some events. Users need to be able to add N number of people to a given event. Choosing people is handled by a partial view.

I'm trying to build a menu that displays when users click "add a person" to the event. Because the event hasn't been filled out completely yet, there is nothing in the database to persist between requests.

I also have validation logic on the event page.

My proposed solution is to add the form to search or add for people on the event form itself and have a submit button that sends the values that have been added back to the server, where I can store them in ViewData or Session.

Unfortunately, doing this flags the validation.

My second solution is to load a partial view responsible for loading the UI to add/search for a person. I could add a little code on the method in the controller that returns a partial view storing the existing data in a session variable or viewdata. Trouble is, I have to submit the form to do it--again tripping the validation!

I'm wondering if perhaps I chose the wrong tool to do this...because in webforms, there would probably be a postback and you would just perform an operation on that postback. I'd like to avoid rewriting the application in webforms and am wondering if there are ways I'm overlooking in ASP.NET MVC.

View 1 Replies

ADO.NET :: Persist The Changes In Datamanager.dbml File?

Dec 6, 2010

I am using Linq first time.

It has a Datamanager.dbml file

Stored procedure just drag here and method are created correspondence that stored procedure.

If i change any thing in any method in dbml file and drag any stored procedure here then All changes are lost.

Means if i change in a method in dbml file. And i drag a new stored procedure in that file then changes are lost and that particular method have its earlier formation that was by default generated by
dbml file.

How can i persist my changes in dbml file.

View 1 Replies

MVC :: Persist Viewdata That Changes In The Master Page?

Dec 21, 2010

I have a nested master page with radio button controls and one or two dropdowns (depending on the radio button chosen). The dropdown(s) contains either carriers or our customers. If the dropdown type is customer, we display another dropdown to determine what type of customer (current, former, or test). Once a carrier or customer is chosen, an action is called to "set" the customer information in the session. This all works great. The problem is trying to persist the dropdown type, customer type, and customer or carrier chosen over each action/view. Once a customer or carrier is set, the user can chose different menu options (also on the master page) to perform different tasks against the customer or carrier data. I am still fairly new to asp.net mvc and to jquery and ajax. I have racked my brain and tried several different scenarios to get this to work. I tried a master view model which got inherited by the other view models. I couldn't get that to work. Now I am trying a base controller and just setting things in viewdata, but I still can't get it to work once I move to next controller/action/view. Can someone please let me know the best practice for doing this? And or tell me where I'm going wrong? I am at a pretty critical point in this project and am running out of time. The code follows:

Global.asax:

[Code]....

Site.Master:
[Code]....

View 4 Replies

Make Private Chat System In C#?

Jan 2, 2010

i want to make private chat system in asp.net

View 8 Replies

Private IP Of Client Machine From Website?

Feb 2, 2011

how can I get the private ip of client system from a website hosted on public ip in ASP.Net C#? while i am checking userhostname, it's showing the global IP of the Internet connectivity which is the same for all the machines in the network.

View 2 Replies

Sign Emails With Private Key For DKIM?

Jul 16, 2010

Jeff Atwood has a good post on ways to pass email spam filters in his post at:[URL]

The only issue I have is figuring out a way to sign the email with a private key for DKIM. We use the MailMessage and SmtpClient objects that come with ASP.NET 3.5. How can I sign an email with these objects?

Also, we use the free SMTP Server that comes with Windows 2008 R2. I don't believe there is a way to sign from that server, if there is way I'm open to using that approach.

View 1 Replies

Use PKI Public And Private Encryption For Authentication?

Dec 17, 2010

I want to use PKI public and private encryption for authentication to allow for a more streamlined and secure application access control system. generation of certificate and authentication will be useful. One more question, can i use System.Security.Cryptography.X509Certificates class for the same?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved