|
Hi there everyone
I am creating a web based application usiing C#. On the register user page I would like to encrypt the password on the client side. To do this I am using Java Script. However I am uncertain and cant find out how to pass parameters to my JS function So far i have this:
Page_Load()
{
btnSubmit.Attributes.Add("onClick", "encrypt(this.Form)");
}
then the JS is something like this
function encrypt()
{
var key = lblPublic.innerHTML;
var s = txtString.innerHTML;
DoEncrytion(key, s)
}
I am unsure how to what type to pass to encrypt() and just generally unsure of how to make it work.
Any help will be greatly appreciated
Thanks
Dan
|
|
|
|
|
If your variable is in C#, then you need to inject code which creates a jscript variable and sets it to the value you have in your C# code. So, your JS is injected with registerclientscriptblock, and is created to pass the value through
|
|
|
|
|
First of all, why would you encrypt anything client side? Everything that you use for the encryption is visible to anybody, sore there is no security gained.
What is it that you want to pass to the Javascript function? What do you want to happen?
---
b { font-weight: normal; }
|
|
|
|
|
Hi sorry i dont think I was clear enough.
I am using an RSA algorithm so i send my public key to the client side and it is used to encrypt what is stored in a txtBox. I need to know how to pass the txtbox contents to the function
cheers
Dan
|
|
|
|
|
I'm not entirely sure I understand what you're trying to do, but here's a few tips that might help.
If simply need a value passed to js, you can use a literal. I'm doing this from memory so the syntax might be a little off, but it should look something like this:
In JS:
<br />
<script lang="javascript"><br />
<!--<br />
var x=<asp:Literal ID="MyVar" runat="server" />;<br />
</script><br />
and in your code put something like
MyVar.Text="bob";
If you need to work with the DOM, you can use the ClientID property of your controls, and write them out in much the same way. ClientID is what will actually get written to the page.
btnSubmit.Attributes.Add("onClick", string.Format("encrypt({0})",control.ClientID));
or use a literal as before if it's not an event. Then inside the "encrypt" js function you can use the parameter as a control object (TextBox, or whatever).
You can use the ClientScriptManager to accomplish the same thing in code as mentioned before, but I find it more useful for controlling script that is dynamically added to a page such as script included with a control, not so much for merely formatting the script.
|
|
|
|
|
How can I know if the Screen Saver is running or not from inside my app. I'm using C# on .NET 1.1
Regards.
|
|
|
|
|
Have a look at the Win32 function SystemParametersInfo (needs Win2K or better);
you'll want the action value SPI_GETSCREENSAVERRUNNING = 114 (can be found in Winuser.h)
using System.Runtime.InteropServices; // DllImport
[DllImport("user32.dll")]
public static extern int SystemParametersInfo(
int uiAction, int uiParam, out int pvParam, int fWinIni);
Luc Pattyn
|
|
|
|
|
hi
does anybody know how to use reporting services in sql 2005 in VC# 2005 ??
thanks.
|
|
|
|
|
Have you tried File => New Project => Report Project?
|
|
|
|
|
yeah i know.
but i want to pass my parameters to sql report and i want know how to publish my app and how to use sql server advance and ...
|
|
|
|
|
That's not what you asked originally. Next time you might want to describe your actual problem in more detail.
This may help:[^]
|
|
|
|
|
hi
im not sure on the correct name of what i want to do so seaching is very hard for me.
anyway what i want to do is store an external exe into my app then expand it at runtime when needed deleting it when the program has finished.
ie
i have an exe called patch.exe and i need to pass say these params to it
patch -a -b -c.
i can run it and do what i like if i tell my app the full path to the file
(ie c:\patcher\patch.exe)but would like to unpack the exe from my app into the same dir as the app run it then delete it.
so instead of
proc.StartInfo.FileName = "c:\patcher\patch.exe" its
proc.StartInfo.FileName = "patch.exe" and it runs the unpacked exe
hope this makes sense
choss
|
|
|
|
|
Why not just place the patch into the setup package, and then run it from your executable?
|
|
|
|
|
im currently doing that but i want to add a new feature with maybe 100 patches to go with it and at least want the patch files stored in the exe
i also just would like to now how everyone else does it
|
|
|
|
|
Why in the world would you want to package patches with the original distributable? Why not just rebuild the app, and forgo the patches.
As far as everyone else, nobody does it this way. There is probably a part of the app that checks the web, and DLs the patches and installs them. Embedding them makes no sense at all.
|
|
|
|
|
edboe wrote: Why in the world would you want to package patches with the original distributable?
because my current app will act as a gui for a dos program which i have made over 100 patches for and each patch is a seperate file i want all of these contained in the exe and theres is no generic patch as it check the md5 of each selected bin file and wont patch if a mismatch is found.
edboe wrote: As far as everyone else, nobody does it this way.
everybody in my scene does it this way
|
|
|
|
|
Have you tried Resgen.exe?
|
|
|
|
|
You can also check this article:
http://msdn2.microsoft.com/en-us/library/7k989cfy(VS.80).aspx
|
|
|
|
|
Why not just store the .exe as an embedded resource in your app?
|
|
|
|
|
Does it matter if I open the .csproj file or .sln file to EDIT my project?
I have one sln file that contains two projects. I tried to open one of the .csproj files and I was able to view in the Solution Explorer the sln and the two projects that belong to the sln and other information.
Is there a valid reason for me to open .sln instead of .csproj when have multiple projects?
|
|
|
|
|
The .sln file contains information about the projects that are required to compile your whole solution. The .csproj just contains information about which files are in the particular project and how to compile them. If opening your .csproj file results in all the projects getting loaded, then VS is basically opening the .sln in the background. You should just open the .sln file.
|
|
|
|
|
You can do it. Just back up the original in case you change something that is critical.
|
|
|
|
|
i designed a mobile application,
is this application can be run on Nokia 9110 Communicator?
thanks for help
MD_NADA
|
|
|
|
|
That isn't enough information to answer your question. What operating system does the Nokia 9110 Communicator run? Did you use the .NET Compact framework to build your application or some other framework?
|
|
|
|
|
I may be wrong, but i think it uses geos. If that is the case, no.
|
|
|
|