|
but will it be sql injection proof.
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
|
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "insert Tbemployee(TE_VC50_EmpName,TE_VC50_EmpImg,TE_VC50_EmpDesignation,TE_NU_EmpDepId)values(@empname,@empimg,@empdes,@empdepid)";
cmd.Connection = con;
cmd.Parameters.Add("@empname", SqlDbType.VarChar,50).Value = txtname.Text;
cmd.Parameters.Add("@empimg", SqlDbType.VarChar, 50).Value = fu_img.FileName;
cmd.Parameters.Add("@empdes", SqlDbType.VarChar, 50).Value = txtdes.Text;
cmd.Parameters.Add("@empdepid", SqlDbType.Int).Value = DDLTeam.SelectedValue;
fu_img.SaveAs("D:\\ION Projects\\IonIntranet\\IonIntranet\\Images\\EmpOM\\" + fu_img.FileName);
cmd.ExecuteNonQuery();
txtname.Text = "";
txtdes.Text = "";
cmd.Dispose();
every time file upload control return null value..any advice.
|
|
|
|
|
Hi,
Hmmmm.... The path should not be hard coded.
fu_img.SaveAs("D:\\ION Projects\\IonIntranet\\IonIntranet\\Images\\EmpOM\\" + fu_img.FileName);
Please use virtual path(Server.mapPath) and the folder should be inside the application folder.
Regards
Anil Pal
|
|
|
|
|
its working when i remove update panal.. but with update panal its not working.. can we apply more than one script manager on page or more tan one update panal in one page with one script manager
|
|
|
|
|
|
you cannot apply more that one script manager but u can use more then one update panel.
set mode conditional of update panel.
Regards,
Keyur Satyadev
|
|
|
|
|
thnx fren its working now..
|
|
|
|
|
hi,
I have created a tab using menu control and multiview.I want send a value when browsing from one tab to another.The value is to sent while visiting form one tab to another.HOw can I do this?
regards
bill
|
|
|
|
|
Please give more details.
Regards
Anil Pal
|
|
|
|
|
I am developing website in Asp.net 2.0 and planning to implement Ajax.
Can any one please suggest me which is best to use either
Jquery (or) Ajax control Toolkit..
I appreciate if you could give the reply soon...
Ramkumar(senior pgmr)
|
|
|
|
|
The control toolkit is excellent for morons. It basically does all hte work for you, so long as you want what it does. JQuery is an excellent library, but it doesn't give you the sort of prebuilt controls that ASP.NET AJAX does.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Use ajax toolkit. Its very easy to use with VS.net.
Cheers!
Regards
Anil Pal
|
|
|
|
|
thanks a lot...shall i start my project with Ajax tool kit itself?
Ramkumar(senior pgmr)
|
|
|
|
|
Yes , you can procced with it.
Regards
Anil Pal
|
|
|
|
|
I have to add the facilities of adding water mark on video files.
I am developing my application in c#.
any body help me for the same.
Thanks In advance.
|
|
|
|
|
Don't cross post. ASP.NET can't watermark a video, so asking in the C# forum, as you have done, is the right thing to do.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Dear Experts,
Do you have any idea encrypted string in Java and decrypt in asp.net using the same AES algorithm?
|
|
|
|
|
Sure - if it's the same algorithm, that should work just fine.
Help me is a stupid subject line. Everyone here wants help.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I am trying to decrypt the string in asp.net which is encryted in java.I am able to do it till some extent but its not completely decrypting.
Here i am putting the code of both (Decryption through ASP.NET and Encryption through Java)
private String Encrypt() /// Done in Java return encryted string
{
String hexString="";
String msg="Sample Input Text";
SecretKeySpec skeySpec ="GbxDwxcjvjtpi0+lQuyfHg=="; // Autogennerate Key
try
{
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
byte[] encrypted = cipher.doFinal(msg.getBytes());
hexString=asHex(encrypted);
}
catch(Exception e)
{
System.out.println("Error in Encrypt"+e);
}
return hexString;
}
private void DecryptFunction() // Done in Asp.net
{
try
{
string strEncrypt = "fc8caff8581f9a3920b788490c3569ffb345e54c7f72a73ddb76256ff81fbfd6";// Encrypt string
string AutoKey= "GbxDwxcjvjtpi0+lQuyfHg==";
TripleDESCryptoServiceProvider tdes = new TripleDESCryptoServiceProvider();
tdes.Key = Encoding.UTF8.GetBytes(AutoKey= );
tdes.Mode = CipherMode.ECB;
tdes.Padding = PaddingMode.PKCS7;
ICryptoTransform crypt = tdes.CreateDecryptor();
byte[] cipher = FromHex(strEncrypt);
byte[] plain = crypt.TransformFinalBlock(cipher, 0, cipher.Length); // Here Error showing
Response.Write("Decryped string : " + System.Text.Encoding.UTF8.GetString(plain) + "<br/><br/><br/><br/>");
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}
Here decryt function should be return decrypt string means Sample Input Text but its showing Bad Data error.
I give error screen shot also.
Server Error in '/WebSite1' Application.
--------------------------------------------------------------------------------
Bad Data.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Security.Cryptography.CryptographicException: Bad Data.
Source Error:
Line 76: ICryptoTransform crypt = tdes.CreateDecryptor();
Line 77: byte[] cipher = FromHex(strEncrypt);
Line 78: byte[] plain = crypt.TransformFinalBlock(cipher, 0, cipher.Length); // Here Error showing
Line 79: Response.Write("Decryped string : " + System.Text.Encoding.UTF8.GetString(plain) + "<br/><br/><br/><br/>");
Line 80:
Source File: c:\Documents and Settings\tmani.MILESDNS01\My Documents\Visual Studio 2005\WebSites\WebSite1\SSoFinal.aspx.cs Line: 78
Stack Trace:
[CryptographicException: Bad Data.
]
System.Security.Cryptography.CryptographicException.ThrowCryptogaphicException(Int32 hr) +33
System.Security.Cryptography.Utils._DecryptData(SafeKeyHandle hKey, Byte[] data, Int32 ib, Int32 cb, Byte[]& outputBuffer, Int32 outputOffset, PaddingMode PaddingMode, Boolean fDone) +0
System.Security.Cryptography.CryptoAPITransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount) +200
SSoFinal.DecryptFunctionINGData() in c:\Documents and Settings\tmani.MILESDNS01\My Documents\Visual Studio 2005\WebSites\WebSite1\SSoFinal.aspx.cs:78
SSoFinal.Page_Load(Object sender, EventArgs e) in c:\Documents and Settings\tmani.MILESDNS01\My Documents\Visual Studio 2005\WebSites\WebSite1\SSoFinal.aspx.cs:20
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +31
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +68
System.Web.UI.Control.OnLoad(EventArgs e) +88
System.Web.UI.Control.LoadRecursive() +74
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3035
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
I would appreciate some help
Regards
Mani
|
|
|
|
|
Hy,
I m using query sring to pass value to another page. can any one tell me how to encrypt the query string value and then decrypt it on the other page
|
|
|
|
|
Use the Cryptography namespace to encrypt and decrypt strings.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Follow the below steps: I am posting with small exmaple
A.Code in sender page of uery string
1.string strID = "A0123456789";
2. Response.Redirect("../Search/DocumentSearch.aspx?ID=" + Encrypt(strID));
3.public string Encrypt(string strValue)
{
string encryptedResult = String.Empty;
string passPhrase = "Pas5pr@se";
string saltValue = "s@1tValue";
string hashAlgorithm = "SHA1";
int passwordIterations = 2;
string initVector = "@1B2c3D4e5F6g7H8";
int keySize = 256;
byte[] initVectorBytes;
initVectorBytes = Encoding.ASCII.GetBytes(initVector);
byte[] saltValueBytes;
saltValueBytes = Encoding.ASCII.GetBytes(saltValue);
byte[] plainTextBytes;
plainTextBytes = Encoding.UTF8.GetBytes(strValue);
PasswordDeriveBytes password;
password = new PasswordDeriveBytes(passPhrase, saltValueBytes, hashAlgorithm, passwordIterations);
byte[] keyBytes;
keyBytes = password.GetBytes((keySize / 8));
RijndaelManaged symmetricKey;
symmetricKey = new RijndaelManaged();
symmetricKey.Mode = CipherMode.CBC;
ICryptoTransform encryptor;
encryptor = symmetricKey.CreateEncryptor(keyBytes, initVectorBytes);
MemoryStream memoryStream;
memoryStream = new MemoryStream();
CryptoStream cryptoStream;
cryptoStream = new CryptoStream(memoryStream, encryptor, CryptoStreamMode.Write);
cryptoStream.Write(plainTextBytes, 0, plainTextBytes.Length);
cryptoStream.FlushFinalBlock();
byte[] cipherTextBytes;
cipherTextBytes = memoryStream.ToArray();
memoryStream.Close();
cryptoStream.Close();
string cipherText;
cipherText = Convert.ToBase64String(cipherTextBytes);
return cipherText;
}
B. Code in receiver page of querystring
1.string strID = Request.QueryString["ID"].ToString();
string plainValue= Decrypt(strID);
2. public string Decrypt(string encryptedResult)
{
string passPhrase = "Pas5pr@se";
string saltValue = "s@1tValue";
string hashAlgorithm = "SHA1";
int passwordIterations = 2;
string initVector = "@1B2c3D4e5F6g7H8";
int keySize = 256;
byte[] initVectorBytes;
initVectorBytes = Encoding.ASCII.GetBytes(initVector);
byte[] saltValueBytes;
saltValueBytes = Encoding.ASCII.GetBytes(saltValue);
byte[] cipherTextBytes = new byte[encryptedResult.Length] ;
cipherTextBytes = Convert.FromBase64String(encryptedResult);
PasswordDeriveBytes password;
password = new PasswordDeriveBytes(passPhrase, saltValueBytes, hashAlgorithm, passwordIterations);
byte[] keyBytes;
keyBytes = password.GetBytes((keySize / 8));
RijndaelManaged symmetricKey;
symmetricKey = new RijndaelManaged();
symmetricKey.Mode = CipherMode.CBC;
ICryptoTransform decryptor;
decryptor = symmetricKey.CreateDecryptor(keyBytes, initVectorBytes);
MemoryStream memoryStream;
memoryStream = new MemoryStream(cipherTextBytes);
CryptoStream cryptoStream;
cryptoStream = new CryptoStream(memoryStream, decryptor, CryptoStreamMode.Read);
byte[] plainTextBytes= new byte [encryptedResult.Length ] ;
//object plainTextBytes;
int decryptedByteCount;
decryptedByteCount = cryptoStream.Read(plainTextBytes, 0, plainTextBytes.Length);
memoryStream.Close();
cryptoStream.Close();
string plainText;
plainText = Encoding.UTF8.GetString(plainTextBytes, 0, decryptedByteCount);
return plainText;
}
Cheers!
Regards
Anil Pal
|
|
|
|
|
instead of encrypt the query string you have to use the urlrewriting.
so that you can get exact url.
Regards,
Keyur Satydev
|
|
|
|
|
Crystal Report working in IDE 2008 but when i publish web project
and try to run it from IIS 5.0 I got this kind of error.
Logon failed. Details: ADO Error Code: 0x Source: Microsoft OLE DB Provider for SQL Server Description: Login failed for user 'UserName\ASPNET'. SQL State: 42000
Please help me in this matter
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|