|
Hi! How I can get the value of <fullname> programatically in a code-behind file and put in a label. I have declared in the web.config a statement:
profile
properties
add name="FullName" defaultValue="Anonymous" allowAnonymous="true"
properties
profile
now I want to get the value of the FullName in the code-behind file?
so the LabelName.Text = ???
Thx, Laziale
|
|
|
|
|
I guess you've got the wrong forum, try ASP.Net forum instead
Regards,
Lev
|
|
|
|
|
Hi all,
I have a 32-bit process that presents the user a dialog box similar to Regedit. On 64-bit OSes, because of registry redirection, when I attempt to read something under HKLM\SOFTWARE, the OS transparently provides my app with the data that appears under HKLM\SOFTWARE\Wow6432Node. That's great and all...
However, since my app is 32-bit, any data that has been written to HKLM\SOFTWARE by a 64-bit app is not visible to me.
Whether I set the path to read as HKLM\SOFTWARE or HKLM\SOFTWARE\Wow6432Node yields the same results--I'm only seeing the values that appear under HKLM\SOFTWARE\Wow6432Node.
My app has the ability to connect to the registry across the network--if I'm on a 32-bit OS and remotely access the registry of a 64-bit machine, then I'm seeing both branches just as Regedit would show them (since registry redirection does not work across machine boundaries, I'm getting the "raw view").
Compiling my app as 64-bit (or AnyCPU) is not an option right now, because my app also relies on third-party components that are only available as 32-bit.
So...how can a 32-bit app, running on a 64-bit OS, access the data under the "real" HKLM\SOFTWARE? Read-only would be fine--I just need the data to be visible...
PS - I'm aware of the KEY_WOW64_64KEY and KEY_WOW64_32KEY flags...however, I'm not seeing any provisions in .NET's registry classes to specify them...do I really have to rewrite my existing code to use P/Invoke??
modified on Saturday, December 13, 2008 11:59 AM
|
|
|
|
|
The following info is from MSDN:
By default, a 32-bit application running on WOW64 accesses the 32-bit registry view and a 64-bit application accesses the 64-bit registry view. The following flags enable 32-bit applications to access reflected keys in the 64-bit registry view and 64-bit applications to access reflected keys in the 32-bit registry view.
Flag name Value Description
KEY_WOW64_64KEY 0x0100 Access a 64-bit key from either a 32-bit or 64-bit application.
Windows 2000: This flag is not supported.
KEY_WOW64_32KEY 0x0200 Access a 32-bit key from either a 32-bit or 64-bit application.
Windows 2000: This flag is not supported.
These flags can be specified in the samDesired parameter of the following registry functions:
RegCreateKeyEx
RegDeleteKeyEx
RegOpenKeyEx
|
|
|
|
|
Daniel Desormeaux wrote: do I really have to rewrite my existing code to use P/Invoke??
Yes.
|
|
|
|
|
Amazing. I'd love to understand MS's reasoning.
|
|
|
|
|
Hello All,
I'm developing a distributed data processing system that requires frequent synchronization of a large file base (~4 GB in approx. 40000 files) among 10 or more workstations. The master file base is created on one of the workstations, and has to be distributed to the other ones over a local network.
To avoid a bottleneck of simultaneous downloading files from a single workstation, I would like to create a peer-to-peer protocol that would allow redirecting the download request received by the master workstation to another workstation which has already downloaded a given file.
Which technology of those available in the .NET Framework should I employ for that purpose?
|
|
|
|
|
Have a look at Windows Communication Foundation (WCF).
|
|
|
|
|
Hi,
I was wondering how i could prevent empty cells when the user adds a new row in the datagridview?
Because the gridview is bouned to an sql database, some fields are not allowed to stay empty.
Any idea how to get this trick done?
Thanks in advance!
|
|
|
|
|
Just add validation, check if the cells are empty before doing a save, and if they are, tell them to fix them.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
How can I return value from a thread??
Thanks in advance
Anvesh
|
|
|
|
|
Hi,
there are many ways you can pass data to a thread, and retrieve results.
For one, there is a possibility to pass an object to Thread.Start(); so you could store all the inputs in that object before you start the thread, and/or retrieve all the results once the thread is done.
Or you could turn that around, and have a little class (say class Job), which you instantiate, pass parameters (thru properties maybe), then call its Run method (which launches a thread inside that class, invisible to the outside world), and finally gets the results available somehow (e.g. again as Properties). This is my preferred way; it makes it very easy to run several similar jobs at the same time, just by instatiating more Job objects and Run()ning them.
|
|
|
|
|
You can use the class BackGroundWorker and handle the completed event and getting the property "Result" of the event args
Saludos!!
____Juan
|
|
|
|
|
I want to create a key to my application. When installed at client for the first time it should install. If the client want to install again it should not install.And if the client want to copy the setup file it should not be copied to any other location.
|
|
|
|
|
Unless your application "phones home" to a license server on your end, there's no way to stop this from happening. A client will be able to install your app as many times as they want.
|
|
|
|
|
Hey
I want to inject DLL made in C# into an Application.
Ive been looking for this for a long time, but still cant find the answer.
In C you would use it like this
BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
MessageBox(0, "Test", "Test", MB_OK);
break;
case DLL_PROCESS_DETACH:
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
}
return TRUE;
}
Is there a way to do this in C#? Like when I inject it, that it also shows the MessageBox at successfull injection?
Thanks in Advance
- opx
|
|
|
|
|
LoadLibrary[^] will call DllMain for you, so you can use P/Invoke for that task.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thank you for your kind reply, but I still dont get it.
Im not really familiar with LoadLibrary...
This is what I got so far
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace MyDll
{
public class clsMain
{
[DllImport("kernel32.dll")]
public static extern IntPtr LoadLibrary(string lpFileName);
}
}
|
|
|
|
|
So did you actually call the method?
LoadLibrary("YourDll.dll");
if this returns some value != IntPtr.Zero then the call was successful.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thank you
You see, im using a program called Winject to inject the dll. I guess that really does it all.
When it gets injected, it automatically calls the LibMain function and executes the code in my Dll.
But when I try to inject the dll I made in c#, it doesnt get executed, this is the code im using:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace MyDll
{
public class clsMain
{
[DllImport("kernel32.dll")]
public static extern IntPtr LoadLibrary(string lpFileName);
[DllImport("user32.dll")]
public static extern int MessageBox(int hwnd, string lpText, string lpTitle, int style);
public void LibMain(IntPtr hInstance, int fdwReason, int reserved)
{
MessageBox(0, "Injected from C#", "C# hello world", 0);
}
}
}
Thank you very much again!
- opx
|
|
|
|
|
I'm confused, do you have a native DLL or a .NET DLL? First, you presented a native DLL, now you're showing me the code of a .NET DLL, which works totally different and where LoadLibrary has no effect on.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I wanted to make a Dll like c but in c#, so yes a native Dll.
I want it to be injected into a process, and not called.
But I guess C# is not really a good language for this, right?
Thanks for your replies
- opx
|
|
|
|
|
OptiPlex wrote: I want it to be injected into a process, and not called.
I'd rather use a native DLL, then.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
If you want to inject your DLL code into another process, which you do not control, your .DLL MUST be written in a non-managed language (non-.NET). That means that you cannot use C# to write the .DLL. .DLL injection only works with native-code, not managed.
|
|
|
|
|
Okay, I got the answer for my question now. Thank you all!
|
|
|
|