Web Forms :: Encrypted String Doesn't Match With Targeted String?
Feb 23, 2011
i have created a encrypted string to match with a target string to pass it along with client URL for authentication. it doesn't match. here is an algorithm used to create a encrypted string.
I have tried using .NET's various encryption functions but all my encrypted strings are at least 24, 28 or 32 in length.
I have heard of CipherMode.CTS with Padding = None that produces the same length output as the input length but I can't seem to get the same result. I have toyed with the block-size, key-size and salt size.
I don't mind adding a digit to my input string to make it 16 in length.
 <add name="strConnectionString" connectionString="eF8w9r2UJOsk0Ps3pxmV7/Fy/xPR2hN2S7BrC1iOYNnAUaI8AqkSm5bw7r+ta4sePWSV9t/3Spnpz6wsFpvMmcppNpqM5Zk7iiDqWVgIV4k="/>
So when i running website it throw error:
System.ArgumentException:Keyword not supported: 'eF8w9r2UJOsk0Ps3pxmV7/Fy/xPR2hN2S7BrC1iOYNnAUaI8AqkSm5bw7r+ta4sePWSV9t/3Spnpz6wsFpvMmcppNpqM5Zk7iiDqWVgIV4k='.
Line 46: string[] roleNames; Line 47: roleNames = Roles.GetAllRoles();
I encrypt and decrypt a string with a private key and following functions. so I encrypt a string with Encrypt function and decrypt the encrypted string with decrypt function. If someone can change the encrypted string and then it decrypts with decrypt function, the decrypted string isn't equal to plain text before encrypting. I want to know how can I check is decrypted string equals to plain text before encrypting?
How to run asp.net application with encrypted web.config ,is it possible note that ASP.NET application have a database with encrypted connectionstring and a "cannot read connection string " message is generated
I am trying to match a username to a userid which are in 2 different sql tables. Here is my select statement:
SELECT aspnet_Users.UserName FROM aspnet_Users INNER JOIN aspnet_starterkits_Projects ON aspnet_Users.UserName = aspnet_starterkits_Projects.ProjectManagerId
When I run this i get an error message: "Conversion failed when converting from a character string to uniqueidentifier" Is there anyway around this? Or a different select statement etc?
I want to generate a link http://site/?code=xxxxxxxxxx
Where xxxxxxxxxx is an encrypted string generated from the string user01. And I will need to convert it back later.Is there a simple way to encrypt and decrypt a string like this?
and at the page load event i retrieve the value of the label & assign it to a string !
stringvalue = lbl_Hidden.Text;
Now i dont know why this manipulation does'nt work! I've a character 'A' in the string and i'm unable to replace it with a space ! stringvalue.Replace(A, " ");
 //Read string contents using stream reader and convert html to parsed conent var parsedHtmlElements = HTMLWorker.ParseToList(new StringReader(contents), null);  //Get each array values from parsed elements and add to the PDF document foreach (var htmlElement in parsedHtmlElements) pdfDoc.Add(htmlElement as IElement);  //Close your PDF pdfDoc.Close();  Response.ContentType = "application/pdf";  //Set default file Name as current datetime Response.AddHeader("content-disposition",
[Code] ....
Error: Input string was not in a correct format. Contents in html file giving error ...
I took over some old php application with MySQL as database. Inside the database, there are tables including content with localized strings (therefore containing special chars)Currently there is a PHP application accessing that database. My job is to create an ASP.net (C# codebehind) application that accesses that strings as well. That works, as far as encoding goes.If I try to access these strings, I do get a kind of encoding problem, like 'Ändern' and 'Prüfzeichen', but only in the ASP.net application. The PHP app sets utf-8 as charset and the strings are perfectly rendered. In the ASP.net application it's gibberish, regardless of the page encoding.In the MySQL database, the charset for the specified table 'translations' is set to 'latin --cp1252 West European' and collation to 'latin_swedish_ci'.I can't seem to figure out what PHP apparently does, and ASP.net does not. I traced the php code and could not find any sign of special encoding while getting a string from the database.The question is, how can I ensure correct encoding inside the ASP.net application without modifying the database, because big changes at the php code are not possible?
I am trying to read a normal string from the web.config file. When I try to read a string from the web.config file the application doesnt seem to read it. I set my sqlconnection string in the web.config file. It reads a sqlconnection string but not a normal string.Here is my code:
I have Membership configured with IIS7, tables for it located in my own database, created with aspnet_regsql utility, and I am using custom connection string to access it.
This is part of web.config related to Membership :
on VWD 2005 this code works fine, but on 2008 it says I haven't created an instance of the object. I want to convert the object connString (a connection string) into a string.
'This acceses the virtual directory web.config file for connection strings 'We have to convert the object to a connection string Dim rootWebConfig As System.Configuration.Configuration rootWebConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/VirtualDirec") Dim connString As System.Configuration.ConnectionStringSettings connString = rootWebConfig.ConnectionStrings.ConnectionStrings("ConnectString1") Dim strConnString As String = connString.ToString().......
I'm concatenating a string in codebehind to use in a sql select statement.
in aspx
<asp:Label ID="LabelHidden" runat="server" Visible="False"></asp:Label> SelectCommand="SELECT * FROM [Data] WHERE [ActivityName] IN (@ActivityName) AND ([ID] = @ID)" <SelectParameters> <asp:ControlParameter ControlID="DropDownList_Employees" Name="ID" PropertyName="SelectedValue" Type="Int32" /> <asp:ControlParameter ControlID="LabelHidden" Name="ActivityName" Type="String" /> </SelectParameters> in codebehind foreach (ListItem li in ListBox_Activities.Items) { if (li.Selected) { queryBuilder += li + "', "; } queryBuilder = queryBuilder.Substring(0, queryBuilder.Length - 1); LabelHidden.Text = queryBuilder;
When i run the code it comes up blank. I did a query trace and it seems to be running as
exec sp_executesql N'SELECT * FROM [Data] WHERE [ActivityName] IN (@ActivityName) AND ([ID] = @ID)',N'@EmployeeID int,@ActivityName nvarchar(50)',@EmployeeID=4,@ActivityName=N'Production Technical Support'', Tools Development'','
with exta "'s
How can i format the queryBuilder string correctly in my code?
At debug time I would like to see what are the keys in my InitParams collection - I can't seem to be able to list them.
EDIT:As Jon suggests below, this might be a bug within the Silverlight debugger. To reproduce, just create a new Silverlight Application within Visual Studio 2010 and just edit code
{ public partial class MainPage : UserControl { [code]...
I'm trying to build a web page where the user can send the contents of the web page to someone of their choosing. The email body is html scraped from the website. I have it working, but the the problem is that the image src is relative <img src="/images/filename.jpg"> and I need to make it absolute. What function is the best for me to use on the string that contains my html to make file path absolute in the method I'm trying to create? I tried the following, but am getting error "too many characters in character literal"