3

I have two applications developed in WPF(c#) which are independent on each other. Suppose Project A and B. they are developed separately. i have connected those projects with the Button in project A, on click of that button i am starting project B with Process.start();

now i need to pass String (login) parameter to the another application (B) so user dont need to login again. I have already seen the Command line argument passing but i dont want to use them. also Application.Current.Properties["parameterStringID"] is not useful because i have different app.config for A and B

Is there any way to do this?

4
  • 3
    why not use command line arguments? works perfect. Commented Dec 30, 2013 at 11:24
  • @NahumLitvin : Thanks for help! may be command line will work but i want to know is there any other way to do this? Commented Dec 30, 2013 at 11:31
  • but i dont think that will work for me. Can you explain why you think so? Commented Dec 30, 2013 at 11:43
  • @lomed : now Ok my friend. i dont want to use them. sorry but i cant explain that why that will not work for me. Commented Dec 30, 2013 at 11:45

3 Answers 3

2

You can send commandline arguments to your application like this.

var applicationPath = "Path to application B exe";
var process = new Process();
process.StartInfo = new ProcessStartInfo(applicationExePath);
process.Arguments = "/login=abc /password=def";
process.Start();

And in your ApplicationB start, handle commandline arguments.

Sign up to request clarification or add additional context in comments.

5 Comments

as i said in question they might not work for me.(consider as Special case). :( Sorry bro i wana know another way. thanks for help!
another method is through sending windows messages, or may be use WCF service,
i need to create another application for that one? like WCF service application or Widows service application.
You can create another application as well. But you can also use your current applications to host service in itself. You can make a P2P application.
msdn.microsoft.com/en-gb/library/ms751502.aspx this is a sample chat client. In which applications talk to each other. You can use this reference and implement the same thing in your application.
1

I've solved this in the past by using either anonymous or named pipes, .NET has quite good support for them. There are a few good articles about them on the MSDN site.

2 Comments

Thanks for help! Do you have its example code. So i can better understand. can you please post it?
If you look at the child articles in the link I posted you'll see they have full source code for both server and client side.
1

do all your applications have similar login method?

make a AviCompany Login windows service . the service will be also a WCF service that provides method "Login"

see my chart

https://www.lucidchart.com/documents/view/410f-6e48-52c16052-a63b-4a5e0a009f85

2 Comments

yes my applications having similar login service(WCF). i got your point. but calling Login service again needs the login parameters. what about them?
make another function. call it IsUserLoggedIn. call it before calling Login

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.