Sub RC4Initialize(strPwd)
dim tempSwap
dim a
dim b
intLength = len(strPwd)
For a = 0 To 255
key(a) = asc(mid(strpwd, (a mod intLength)+1, 1))
sbox(a) = a
next
b = 0
For a = 0 To 255
b = (b + sbox(a) + key(a)) Mod 256
tempSwap = sbox(a)
sbox(a) = sbox(b)
sbox(b) = tempSwap
Next
End Sub
Function EnDeCrypt(plaintxt, psw)
dim temp
dim a
dim i
dim j
dim k
dim cipherby
dim cipher
i = 0
j = 0
RC4Initialize psw
For a = 1 To Len(plaintxt)
i = (i + 1) Mod 256
j = (j + sbox(i)) Mod 256
temp = sbox(i)
sbox(i) = sbox(j)
sbox(j) = temp
k = sbox((sbox(i) + sbox(j)) Mod 256)
cipherby = Asc(Mid(plaintxt, a, 1)) Xor k
cipher = cipher & Chr(cipherby)
Next
EnDeCrypt = cipher
End Function
%>
And following is the code for my asp page
<!–#include file=”g.inc”–>
<html>
<head>
<title>TestPage</title>
</head>
<body>
<form action=”G.asp” method=”post”>
<%
dim psw, txt
dim strTemp
txt=”NishantRana”
psw=”myPassword”
strTemp=EnDeCrypt(txt,psw)
response.write “Encrypted Text =” & strTemp & “</Br>”
txt=EnDeCrypt(strTemp,psw)
response.write “Decrypted Text =” & txt
%>
</form>
It mostly happens when IIS is installed after .NET is installed. So in this case we need to make use of aspnet_regiis.exe utility.
1) Go to command prompt
2) Go to the following path
“C:WINDOWSMicrosoft.NETFrameworkv2.0.50727”
depending on the version.
3) Enter “aspnet_regiis.exe -i”
4) It will display the message finished installing
5) Open your IIS
6) Select web service extensions
7) Click on Allow for ASP.NET v2.0.50727
That’s it . Now the IIS has been configured properly
But if you haven’t installed the management studio than in that case you need to make following change in the registry
HKEY_LOCAL_MACHINE / SOFTWARE / Microsoft / Microsoft SQL server / MSSQL.1/ MSSQLSERVER/ LoginMode
Click on it change it’s value from 1 to 2.
Then Restart your sql server service !!!
After you have done this you need to enable you sa account for sql server authentication for this follow these steps
1) Open SQL Server Management Studio Express and Login
2) In Object Explorer, click Security followed by Logins
3) Right click sa user and select Properties.
4) Uncheck Enforce password policy
5) Select Status. Click the Grant and Enabled radio buttons. Click OK
6) Restart your database server and select restart.
The ability to catch certain user actions in code and respond programmmatically. These are theclasses which we can inherit and write event handlers or receivers against them.
Get the values for assembly tag by right clicking the assembly and selecting properties within the GAC.
If we have multiple eventhandler attached to a same event we can specify which handler should be executed first through SequenceNumber tag. It’s value should start from 20000
In case when we need to add controls to our web part we need to override the CreateChildControls method of the base WebPart class along with Render method.
Let’s take a simple example for it, a kind of sample calculator which shows sum of two numbers ]
For this we have added 2 labels, 3 textboxes and 1 button.
On Click of the button the sum of the values entered in textbox1 and textbox2 would be displayed in the textbox3.
The name of the assembly,it’s version, culture and public key token information can be found by right clicking the assembly within gac and selecting properties.
For adding custom properties to our web part we need to do the following
1) Create property.
2) Decorate the property with the following attributes
WebBrowsable – To allow your property to be visible within SharePoint.
WebDisplayName– To provide display name to the property.
WebDescription– To provide description for that property.
Personalizable – To define the scope of it i.e either User or Shared through PersonalizationScope enumeration.
Let’s take a simple example wherein we have 2 properties defined, user will enter value for them and finally when the web part is rendered, we would be displaying their sum within the web part.
namespace AdditionWebPart
{
publicclassSumWebPart : WebPart{
privateint firstVariable;
[WebBrowsable(true),
WebDisplayName(“First Value”),
WebDescription(“Enter value for first variable”),
Personalizable(PersonalizationScope.User)]
publicint FirstVariable
{
get { return firstVariable; }
set { firstVariable = value; }
}
privateint secondVariable;
[WebBrowsable(true),
WebDisplayName(“Second Value”),
WebDescription(“Enter value for second variable”),
The name of the assembly,it’s version, culture and public key token information can be found by right clicking the assembly within gac and selecting properties.