.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

Is it possible to write the same encrypt and decrypt method that in MembershipProvider

Posted By:      Posted Date: August 23, 2010    Points: 0   Category :ASP.Net

Hi, I am very confused about encrypting and decrypting password.

What I did is that, I am using a class that extends SqlMembershipProvider, and when I need to encrypt a password, just called base.EncryptPassword() method to do so.

But still, I did not get to know how things are done here, and I really would like to know its codes.

Can anyone provide the code for me please?


View Complete Post

More Related Resource Links

How write new method for .Net Objects

This might be a very basic question.Like thisDataRow1["ColumnName"].ToString();How can I DoDataRow1["ColumnName"].ToInt();I don't want to use Convert.ToInt / Have my own static Utitlity class and pass the value to it and get value.In  other words would I create new method  for .net objects?Thanks In advance

How to encrypt and decrypt stored procedures?

I encrypt my procedures using with encryption clause, but I do not how to decrypt again.    Is there a command or utility for encrypt and decrypt in Sql 2000? How about Sql 2005? Thanks Haydee

Encrypt in PHP, decrypt in ASP.NET - Encryption doesn't match


Hello all,

I have a problem decrypting a string in ASP.NET wich was encrypted at PHP. As a testcase, i tried to encrypt 'test' in ASP.NET and in PHP, using 3DES in cbc mode. But the encrypted values don't match :(. I want the values to match, so i know for sure i use the same encryption method. Please help me on this, I just don't understand how there are different values...

Here's the code i use in php: 

$cc = "test";

$key = pack("c*", 0x13, 0x56, 0x23, 0x15, 0x81, 0x28, 0x56, 0x51, 0x13, 0x56, 0x23, 0x15, 0x81, 0x28, 0x56, 0x52, 0x13, 0x56, 0x23, 0x15, 0x81, 0x28, 0x56, 0x51);
$iv = pack("c*", 0x42, 0x32, 0x84, 0x25, 0x79, 0x43, 0x11, 0x37);

      $block = mcrypt_get_block_size('tripledes', 'cbc');
      $len = strlen($cc);
      $padding = $block - ($len % $block);
      $cc .= str_repeat(chr($padding),$padding);

$cipher = mcrypt_module_open(MCRYPT_3DES,'','cbc','');
mcrypt_generic_init($cipher, $key, $iv);
$encrypted = mcrypt_generic($cipher,$cc);
echo base64_en

encrypt and decrypt md5 hash text


i am encrypting textbox value in md5 using this coding and passing as querystring , and on other page i want to decrypt.....

so plz tell how can i do this..

System.Security.Cryptography.MD5CryptoServiceProvider x = new System.Security.Cryptography.MD5CryptoServiceProvider();
        byte[] bs = System.Text.Encoding.UTF8.GetBytes(TextBox1.Text);
        bs = x.ComputeHash(bs);
        System.Text.StringBuilder s = new System.Text.StringBuilder();
        foreach (byte b in bs)
        string password = s.ToString();

TCP Client/Server communication: NetworkStream.Write() send partial data unless close() method is re

Hi to all,
I wrote a simple client-server application that comunicate through NetworkStream class. The problems comes when stream.close() and client.close() methods are called. It look like only the first 10415 bytes are sent once those methods are called. So, if the data to send is more than this size, it is automatically truncated.

If I  remove both stream/client close() methods from the code, the data is fully received whatever the size is. I tried various alternative solutions (the ones marked as comments in the sample code), but none of them works.
The only thing that seems to work is adding a manual delay before the close() methods execute with something like that:

For Counter as integer = 0 to 10

The problem is that after delay I still don't know if all the data has been transfered or not. In addition to that, I will have to wait 10 seconds before sending another request, even if the response is just a few bytes of data. I could change at runtime the number of seconds to wait according to the size of the data to send, but I still think that delay is not a solution and will cause adverse effects.

So, for now the only working solution is to remove both Stream/Client Close() methods from

encrypt method in sql



How can I encrypt data in sql server 2005? Is there any method? or I should create a function to encrypt.

Of course I can data in VS2008 before send to sql. But I like to encrypt in sql for more secure.

Best Regards. Morteza


[MVC 3 Beta] The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(S



I'm trying to use the Zippy helper (http://www.weirdlover.com/2010/05/

10/zcontroller-asp-net-mvc-controller-fo-your-scripts-styles-images/) to compress, cache, and unify my javascripts and stylesheets with MVC 3 beta (using Razor engine) but on this line:
I always have this error:
Compiler Error Message: CS1502: The best overloaded method match for 'System.Web.WebPages.WebPageExecutingBase.Write(System.Web.WebPages.HelperResult)' has some invalid arguments

can you help me?

Write Unit Test for method with parameter


I'm trying to build my first MVC site and also write unit test for the first time.  I can't figure how to write unit test for methods that take parameters.  How do I write a test method for this controller action?

public class CustomerController : Controller

        public ActionResult Details(int id)
            var customerDetails = (from c in _entities.Customers
                                  where c.PK == id
                                  select c).FirstOrDefault();

            return View(customerDetails);


AES - Encrypt message in Java / Decrypt in asp.net


im currently developing a project which requires to encrypt message in java platform and decrypt in asp.net. In java, i was asked to use the code below to encrypt the message. But i found out i could not decrypt it as i do not know how to get the key, IV fom java. By the way, im using AES decryption method from http://www.obviex.com/samples/Encryption.aspx.

   import java.security.*;
   import javax.crypto.*;
   import javax.crypto.spec.*;
   import java.io.*;

   * This program generates a AES key, retrieves its raw bytes, and
   * then reinstantiates a AES key from the key bytes.
   * The reinstantiated key is used to initialize a AES cipher for
   * encryption and decryption.

   public class AES {

     * Turns array of bytes into string
     * @param buf	Array of bytes to convert to hex string
     * @return	Generated hex string
     public static String asHex (byte buf[]) {
      StringBuffer strbuf = new StringBuffer(buf.length * 2);
      int i;

      for (i = 0; i < buf.length; i++) {
       if (((int) buf[i] & 0xff) < 0x10)

       strbuf.append(Long.toString((int) buf[i] & 0xff, 16));

      return strbuf.toString();

     public static void main(String[] args) throws Exception

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.

Writing custom MembershipProvider

ASP.NET Membership mechanism allows to use the build-in server tables to store and retrieve user data. By default, this mechanism can only be used with SQL Server database to which Microsoft provides suitable MembershipProvider class.
Inheriting from this abstract class, developer can use his own table(-es) from any database and use any database engine other than SQL Server, like Oracle, DB2 etc.

How to Encrypt Query String Parameters in ASP.NET

Encrypt Query String Parameters in ASP.NET.u can send secure data one page another page u can also use query string to encrypt

Write Custom WebParts for SharePoint 2007

The popularity of SharePoint Portal Server 2003 led Microsoft to tightly integrate the next SharePoint version, Microsoft Office SharePoint Server (MOSS) 2007, with its ASP.NET 2.0 WebPart framework. This tight integration enables the ASP.NET and SharePoint developer to do a number of things that previously weren't possible

How to Encrypt and Decrypt a Password using SQLSERVER 2005?(Video)

Encypt and Decrypt a Password using SQLSERVER 2005(Video)

Serial Port Communication Read and Write using C#.net

In this simple article you will learn that how you can Open and read COM port data using System.IO.Ports Namespace.
Simply just create New Project of windows application in C#.

Import ServiceProcess APIs
using System.IO.Ports

Imports System.IO.Ports

Write Parsing functions which parse port data according to attached device

Sys.Net.WebServiceFailedException: The server method '' failed with the following error:



Let's say we have 2 time consuming functions, aaa and aaa1 inside a aspx page.

        public static string aaa(int i)
            return i.ToString();

        public static string aaa1(int i)
            return i.ToString();



        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
        <span id="displayspan"></span>
        <br />
        <input type="button" value=

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
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