.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Importing the public key of asymmetric key object into RSACryptoServiceProvider

Posted By:      Posted Date: September 30, 2010    Points: 0   Category :Sql Server

I want to use the public key provided by creating SQL asymmetric key Object
in my VB.Net,After searching the Internet i reached the
Using SQL Server 2005 Public Keys in VB.Net thread.
Now the question is How can I use the public key in RSACryptoServiceProvider   ?


View Complete Post

More Related Resource Links

public object on asp,net page


in asp.net can i make public objects on my page, for example

public Customer cust1 = new customer();

and use this object on my entire code???

what are the drawbacks of creating public objects??

a single object will be created for all users??? or each user will have a different object????

How to use the public key of asymmetric keys?

Hi All, I know about the concept of public/private keys,but I cannot figure out the difference between asymmetric keys and symmetric keys encrypted by certificates . Both public/private keys are kept at server side ,like a symmetric key encrypted by a certificate How can i use the public key shown as the result of running the following query? select [name] ,asymmetric_key_id,public_key from sys.asymmetric_keys How can it be used when there exists only two pair of functions(EncryptByAsymKey and DecryptByAsymKey)  ? --yousef

WCF returns private members of the object instead of returning the Public members



I am  using WCF to return a serialized custom object to a web page which access the WCF using a script manager. The problem here is the object returned all the private members instead of the public members although the private members are marked private.

The flow behind this: the asp.net  web site stores the object in SQL State session; all the classes in the object are marked serialized as it is stored in SQL State Session. All the public properties in the classes are marked as <DataMember>. When trying to access this object from the client it lists down all the private members of the class instead of listing the public members.

Please advice!

Many Thanks




Object already exists with RSACryptoServiceProvider



After beating my head against the wall for half a day I finally figured out why I am getting an exception "Object already exists." when trying to instantiated an RSACryptoServiceProvider.


Here was my C# code from .NET 1.1 which worked fine under my ASPNET windows user account:

CspParameters csp = new CspParameters();

csp.KeyContainerName = "MySecretKeyContainer";

svrRSA = new RSACryptoServiceProvider(csp);


When I ran this same code in .NET 2.0 also under my ASPNet windows user account.

I got the following exception and stack trace:


Object already exists.


Stack Trace:
   at System.Security.Cryptography.CryptographicException.ThrowCryptogaphicException(Int32 hr)
   at System.Security.Cryptography.Utils._CreateCSP(CspParameters param, Boolean randomKeyContainer, SafeProvHandle& hProv)
   at System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)

Public object members


I'm busy writing a webservice. One of the tasks is to able a client over the internet to add a record. This records exists of about 50 databasefields. My best guess is this:

- Create a public class with each field as public  string or integer of that class.

- Client dims at his side a variable as new class:

Dim myObj as new MyObjec.MyClass

- he sets al parameters

- He calls webservice.AddRecord(myObj)

- The webservice passes myObj to another project which is my data layer

- The datalayer creates the query and adds the record.

The problem here is to make one class which is available in all projects: client project, webservice project, data layer project. My best guess (as I did it in vb6) is to create a seperate project containing the class. Add a referense from my webservice project en datalayser project to this seperate project. The problem is that the client can't set a reference, so it doesn't know what the class looks like.

I hope this makes sence to you all.

It is not possible to use one project for both the webservice and the data layer. The data layer wil be com-exposed as I need to be able to use it from classic asp.

Please advice me which way to look.

Kind Regards!



"Object contains only the public half of a key pair. A private key must also be provided." with 2 .p


Here's the code:

using ADPTest.com.adp.hrbws;
using System.Security.Cryptography.X509Certificates;
using Microsoft.Web.Services3.Security;
using Microsoft.Web.Services3.Security.Tokens;
using Microsoft.Web.Services3.Security.Cryptography;

namespace ADPTest
    class Program
        static void Main(string[] args)
            // Create the web service proxy.
            HrbService proxy = new HrbService();

            // Add the Username token.
            UsernameToken usernameToken = new UsernameToken("user@ABC"," ");

            // Add the certificate for mutual SSL.
            X509Certificate2 mutualCert = new X509Certificate2 "I:\\auth.pem", "

Thinking about new C# method prototypes: object as dictionary

I recently had to write a small Flickr API. I know many .Net API for Flickr already exist but I needed one for a Silverlight application. Whatever, it's only about building some querystrings so I did it by myself. It's been an opportunity to think again about a classical question: how to pass parameters to a method ?

Imagine you have a generic method to call some Flickr functions.

C# Object Oriented Programming

So far in C# Essentials we have looked at the basics of programming in C# such as variable types and flow control. Although it would be possible to write a functional program using these techniques, there is much more to becoming a proficient C# programmer. C# is, above all, an object oriented programming language and as such any C# programmer will be expected to create object-oriented applications using this language.

Object Oriented Programming

Four core concept of OOP Object Oriented Programming. 1.Inheritance, 2.Polymorphism, 3.Abstraction and 4.Encapsulation

Object-Oriented Programming Concepts

This is the first in a series of articles describing the use of object-oriented programming techniques as implemented by the C# programming language. This series follows the C# Fundamentals tutorial that beginners are advised to read first.

Overview of SharePoint Object Model

SharePoint offers a set of structured server-side objects those are widely used to program SharePoint Applications. These objects are hierarchically arranged and you can drill down through the object hierarchy to obtain the object that contains the components of SharePoint Application you need to use in your code.

What is the difference between "dynamic" and "object" keywords?

Let's take a quick look at the object keyword first. I'm not going to talk a lot about it because it's been around since C# 1.0. This keyword is nothing more than a shortcut for System.Object, which is the root type in the C# class hierarchy. (However, as Eric Lippert pointed out in his blog post, not everything in C# derives from object.) This is a powerful mechanism, since you can assign almost any value to instances of this type.

How to bind GridView and DropDownList controls using DataTable object

In .net framework 2.0, you can load a DataTable in memory by consuming a data source using a DataReader. In this version you will find the flexibility in accessing the DataReader means write access code once and use again and again using DataReader. To see the functionality of DataTable consider an example that is created using VS2005.

Jscript error: Object does not support property or method


 Hi, i have little knowledge on javascript but i need to use this code get from somewhere for a jquery to work.

I face this "Jscript runtime error: Object does not support property or method" whenever im trying to run this page.

In my experience, im get this error msg 9 out of 10 times i use javascript in my system.

Im using Microsoft Visual web developer 2008, i wonder if this is related to my problem, i not sure there is anything i need to add as reference or update anything.

But anyway, in short, i just couldn't use javascript code when using this development tool because of this sort of error.

Anyway, it happen that last time i tried use the same type of jquery code in another project and it seems to work well without an error.

But now when im try to use it again in this recent project i created, it come out with this error and i have no idea how to solve it even look through google and this forum.

It doesn't really seems like its the code problem itself although im not sure, because any javascript code just couldn't work.

So below is my code that i need to use.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" ></script>
<script type="text/javascript" src=&quo

Pass ASP.NET membership identity object across domain?


I am trying to figure a way to SSO with ASP.NET membership and role model.

I can implement custom membership provider which consume web services hosting on a server.

With encryption of data. No problem.

But my question is, If I sign on a website with my provider, got my identity object on that application,

could I pass it to another website on another domain which use the same provider and by doing so, do not need to login again?

If this is possible, I am going to implement this solution. Please tell me what's your take on this.

Send object from one page to another



I want to create object in 1.aspx, and then send it to 2.aspx. This methods are bad, because:

1)Send object with url, like this:


This is not confidential.


Session["field1"] = "12345"; // set
Object foo = Session["field1"]; // get

This is bad too, because in 2.aspx this fields send to textboxes, and if user go to 2.aspx without 1.aspx, he'll see old data. 

Error: Encountered multiple versions of the same assembly with GUID...try pre-importing...TlbImp


Hi!  Can someone tell me how I can troubleshoot the following error: "Encountered multiple versions of the same assembly with GUID...try pre-importing one of these assemblies".

The website developed in VS 2010 (.Net 3.5). This error is only received on my workstation.  Another person developing the site does not experience this issue at all.  Also, not sure if this matters, but on my workstation the 'Assembly Information...' dialog contains no values even though the 'AssemblyInfo.vb' file does specify values for the title, desc, etc.  The GUID being referenced in the error is the main project of the three projects within the solution.

I tried looking through the GAC, but do not see any references to the projects or DLLs in the VS solution and am not sure what else/where to look.

If I delete the copy of the solution on my local machine and pull down a copy from source control (AnkhSVN) the solution will build with no error.  Once I make any changes, such as adding a new aspx file, then the error is received.

I can provide any additional information needed.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend