Setting serviceURI for ClientFormsAuthenticationMembershipProvider - asp.net-mvc

I'm searching a way to set the serviceURI for ClientFormsAuthenticationMembershipProvider in code behind. I wish not to have the app.config being changed. Is this possible ?
I'm accessing services from a windows service as well as from a windows program and configuration should be handled in a central place.
Thanks,
Sascha

It is possible to cast to ClientFormsAuthenticationMembershipProvider ClientFormsAuthenticationMembershipProvider just before doing the authentication. If casted you have a property ServiceUri. Set it and it's done.

Related

How to Set MQGet CodedCharSetID in Apache Camel

currently I am working with Apache Camel and IBM Websphere MQ. In my project, I would like to write xml message into IBM WMQ and to do so I need to change the MQGet CodedCharSetID from 1208 into 819.
Anyone has an idea about how to do so in apache camel?
For your information:
I have tried to use the convertbodyto tag, but it did not worked.
I have also tried to add CCSID property in WMQ Connection Factory Bean, and it also did not worked.
Your help is so much appreciated. Thanks in advance.
Try setting the destination name as queue:///FOO.BAR?CCSID=819 instead of simply FOO.BAR
If that does not work out, there is a workaround to set the option on Camel JMS docs.

Using app.config to determine a common config file

I am doing a windows service, using app.config, where there is a section to retrieve common configuration in another file. Using
AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", "filepath\\file");
works for me, but using
string appconfig = ConfigurationManager.AppSettings["CommonAppSetting"];
AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", appconfig);
does not. It gets from the app.config of the windows service instead of the common configuration.
Anything I did wrong, or is there other better ways of doing it?
You need to reset some variables (ClientConfigPaths) in the ConfigurationManager in order for it to refresh its values. These can be seen in the following accepted answer (complete with code for doing this legwork).
Change default app.config at runtime

Get the Description of a Service?

How may I get the description of a Windows Service like below?
I tried by using the Windows Registry, but the majority of Services appear to not have a description, or the description value is stored in a dll - so this seems to be the wrong approach.
Example:
Windows Time Service (W32Time), the description in the registry is shown as
#%SystemRoot%\system32\w32time.dll,-201
Yet the actual description as seen in Services.msc is:
Maintains date and time synchronization on all clients and servers in
the network. If this service is stopped, date and time synchronization
will be unavailable. If this service is disabled, any services that
explicitly depend on it will fail to start.
-
I have been searching on the MSDN website and came across this:
SERVICE_DESCRIPTION structure
lpDescription
The description of the service. If this member is NULL, the
description remains unchanged. If this value is an empty string (""),
the current description is deleted.
The service description must not exceed the size of a registry value
of type REG_SZ.
This member can specify a localized string using the following format:
#[path]dllname,-strID
The string with identifier strID is loaded from dllname; the path is
optional. For more information, see RegLoadMUIString....
-
pszOutBuf [out, optional]
A pointer to a buffer that receives the string.
Strings of the following form receive special handling:
#[path]\dllname,-strID
The string with identifier strID is loaded from dllname; the path is
optional. If the pszDirectory parameter is not NULL, the directory is
prepended to the path specified in the registry data. Note that
dllname can contain environment variables to be expanded.
Which I think would suggest why viewing the Registry showed the W32Time description as #%SystemRoot%\system32\w32time.dll,-201
If I understand correctly I need to read the dll name in memory and retrieve the strID where the Service description is stored?
This is all confusing for me, I would be grateful if someone could help.
All I need is to get the description of a Service, it surely cannot be as complicated as this can it?
Thanks :)
In all versions of Delphi, the the JEDI JCL contains everything you need to get friendly descriptions of services, and anything else to do with the Service Control APIs.
THe class TJclSCManager in the unit JclSvcCtrl.pas contains a property Services, which includes name and description of each service registered, and lets you also do things like start, stop, enable, and disable services too.
Update: The other answer here from ldsandon points out that the Delphi RTL apparently includes this already in XE2, in the unit WinSvc. See answer below about QueryServiceConfig2. Thanks ldsandon for pointing this fact out.
Call QueryServiceConfig2 (you will find also a C example there).
Whatever you need to do with services should be done through the Service Manager API. Registry data should be treated as "private" to the OS.
Using WMI is another way to use the Windows API directly, for example with the help of the (free) API code generator
WMI Delphi Code Creator
The WMI Delphi Code Creator tool allows you to generate Object Pascal
and C++ code to access the WMI (Windows Management Instrumentation)
classes, events and methods.
Are you using Unicode? The remarks for the RegLoadMUIString function say that only the Unicode version is supported.
The RegLoadMUIString function is supported only for Unicode. Although
both Unicode (W) and ANSI (A) versions of this function are declared,
the RegLoadMUIStringA function returns ERROR_CALL_NOT_IMPLEMENTED.
Applications should explicitly call RegLoadMUIStringW or specify
Unicode as the character set in platform invoke (PInvoke) calls.
Have you tried calling RegLoadMUIStringW directly?
You also can check the GLibWMI library. Free (and source included) library for work with WMI. Include a component named TServiceInfo.
Also is included a demo for work wirh services.
With this component you can access at Win32_Service Class; You can check the properties and structure here.
Regards

JavaFX url-proxy?

My computer is running behind proxy. I want to access url from JavaFX. for example say i want to show image from a url. But i haven't seen anyway to provide proxy settings for the connection(?). Please if someone can tell me how to do things in such situation?
Thanks
As link in accepted answer doesn't work anymore I'm adding proxy setting code here:
System.setProperty("http.proxyHost", "myproxyhost");
System.setProperty("http.proxyPort", "80");
By default, JavaFX will automatically use your Operating Systems proxy settings, this is controlled via the Java Preferences or Java Control panel icons on your Mac or PC.
You can also set, within Java, the proxy environment variables, but I haven't tried this.
If you are trying to request an external resource from an unsigned application, Java may prompt you (the user) for permission when it runs.
Setting proxy in Java/FX

Setting Remote Launch in DCOM

I can use DCOMCNFG to disable remote launch on my DCOM application, but I would like to do this programatically. I looked at CoInitializeSecurity, but that does not seem to do it. Anyone done this?
I am using Delphi BTW.
The binary data is simply a security descriptor structure (PSecurityDescriptor). I mean it is a copy of the memory of this structure. And, of course, the security descriptor is self relative.
JWSCL can create such a structure easily.
Launch- and AccessPermission list for every user access rights that also contain remote and local access.
The permissions for Remote/Local Activation/Launch are stored in the registry under the AppID for the object.
I'm not sure how to edit it programmatically.
This is very similar to change Access Permissions in Component Services > COM Security with script/api? for which i posted a response.

Resources