|
Try to explore Process.Start.
Plenty is available in Google.
Regards,
Arun Kumar.A
|
|
|
|
|
Look at Process.Start as mentioned by the other poster...
|
|
|
|
|
Have a look at MSDN Library for Process.Start(...)
Hope this helps...
|
|
|
|
|
Thanks guys, I was very busy this weekend and did not have a chance to look at it, I will look at it this afternoon.
|
|
|
|
|
Hello ,
I need your help on this, I have a C# 2005 application that includes Crystal reports, whenever I deploy this project I get an unhandle exception saying :"Could not load file or assembly Crystal decisions.Windows.Forms Version.... PublicKeyToken or one od dependencies, the system can't find the specific file" although I included the Crystal Reports on the prerequisites of the Setup file and I always included the assembly Crystal decisions.Windows.Forms to the application folder.
Thanks a lot
Nermeen
|
|
|
|
|
Did you add the merge modules to the setup kit? If not have a look at this[^]
|
|
|
|
|
Hi,
I have a webservice serving a dataset with several tables. Every table has two main webmethods that allows then to interact with the databound controls in the client.
The general form of these methods are (please, its just a sample code to give the idea of the process):
<br />
[WebMethod]<br />
public MyDataSet.MyTableDataTable MyTableGetAll() {<br />
MyDataSetTableAdapters.MyTableTableAdapter vTa = new MyDataSetTableAdapters.MyTableTableAdapter();<br />
return vTa.GetAll();<br />
}<br />
<br />
[WebMethod]<br />
public int MyTableUpdate(MyDataSet.MyTableDataTable pDt) {<br />
MyDataSetTableAdapters.MyTableTableAdapter vTa = new MyDataSetTableAdapters.MyTableTableAdapter();<br />
return vTa.Update(pDt);<br />
}<br />
They work just perfect and I can use any databound control as if the dataset was local.
But how can I add encryptation to this solution without losing the bahavior of the conection.
I know how to send encrypt data via RSA keys thru a webservice but only with basic datatypes (as string or itegers) and even encrypt a content of a XML message. But how can I encrypt the data and the metadata structure (cause it would be terrible to encypt the data and give up the table structure in the resulting XML) and retrieve the DataTable object funcionality at the client side and vice-versa?
The following solution works?
<br />
[WebMethod]<br />
public {XML or String} MyTableGetAll() {<br />
MyDataSetTableAdapters.MyTableTableAdapter vTa = new MyDataSetTableAdapters.MyTableTableAdapter();<br />
return SomeEncryptFunction(vTa.GetAll());<br />
}<br />
<br />
public localhost.MyDataSet.MyTableDataTable GetMyTableData() {<br />
localhost.WebService vSvc = new localhost.WebService();<br />
return SomeDecryptFunction(vSvc.MyTableGetAll());<br />
}<br />
<br />
...<br />
oDataBoundObject.DataSource = GetMyTableData();<br />
...<br />
If It does what would be the code for SomeEncryptFunction and SomeDecryptFunction (the second one is the most important 'cause it has to retreive the DataTable object properly) ?
Thanks in advance for any help about this.
Sir Gallahad
P.S.
I've been reading about implementint security and cryptograpy to web services with WSE SOAP headers. But the articles I've read does not explain well how to code in the client and server side to make the handshake between them.
If that is the solution, can someone help me explaining how to do that.
Please any clue. Any code. Any link. Please.
|
|
|
|
|
hi,
the slution file of my project is not showing in the solution explorer. i can see the project and project file.
how can i see that?
My small attempt...
|
|
|
|
|
hi
Compile your project once, you will see .sln file under your folder. It will not appear in solution explorer. And wht do you want to do with .sln file???
|
|
|
|
|
Try FILE->SAVE ALL.
Sometimes it brings up a dialogue asking where you want to save the solution file...
The save it in your project's folder.
|
|
|
|
|
Hello
I am trying to read contents within HashTable but i am not getting it.
What exactly i am doing is
_mc = MarshallingContext.Unmarshall(s);
IDictionary map = (IDictionary)_mc.RootObject;
So whats going on here is MarshallingContext is the class i created to umarshall the data. So after 2nd step all the contents get stored under map.
Now if you place cursor over map it would show up 3 objects i.e state, owner, request. Well state is a simple string so i can access its data via
_state = (string)map["state"]
So till here there is no problem. Now owner object is a part of {system.Collections.Hashtable}. Under owner there are different keys and value like key = "user", value = "none://anonymous" and 5-6 more keys and value.
Now when i do
_owner = map["owner"];
and print _owner over console i get the system.Collections.Hashtable as a result. Where as i want it to output me all the values in below mentioned format
State : Owned
Owner : {
Machine : client1.company.com
Handle Name : MyHandle
Handle : 82
User : none://anonymous
Endpoint : local://local
Date-Time Requested: 20060302-15:32:34
Date-Time Acquired : 20060302-15:32:34
}
Pending Requests: []
So can any one help me out in this.
If you want me to clarify something particular that i couldnt explain in detail then pls let me knw.
Any or all help would be greatly appreciated.
Thanks
SS.
|
|
|
|
|
try to type cast the object to its original type i.e
Hashtable _owner =(Hashtable) map["owner"];
now from _owner object u can get the value based on the key specified.
rahul
|
|
|
|
|
Thanks its working
|
|
|
|
|
I'm currently getting into exception handling and have encountered the following problem. Let's say we have a class SampleClass. The SampleClass constructor takes various input parameters and is to check whether these are valid. If not exceptions might be thrown. Ideally I would like to have the code creating an object of type SampleClass to handle the potential exceptions. This does not quite work, as the compiler reports "Use of unassigned local variable..." outside the try block.
Here's the code:
<code>
public class SampleClass
{
public SampleClass(int param1, int param2)
{
int param1;
int param2;
if (param1 % param2 != 0)
{
throw new Exception();
}
this.param1 = param1;
this.param2 = param2;
}
public void Action()
{
// Some weird stuff in here.
}
}
public class Tester
{
class Program
{
static void Main(string[] args)
{
SampleClass s;
try
{
s = new SampleClass(20, 20);
}
catch (Exception e)
{
// Do processing here.
}
s.Action(); // Compiler says: Use of unassigned local variable 's'
}
}
}
</code>
I'd be quite pleased if someone could direct me into a promising direction. How to create object instances within try? You might say, just incorporate s.Action() within the try block. The problem is that in the real world example there is lots of code referencing 's'. So I'd end up with a massive try block and dozens of catch blocks afterwards. I reckon that's not what you would call best practices.
Thanks in advance.
All the best.
Goebel
|
|
|
|
|
You can't use s to do something outside the try/catch if the constructor fails. This is because the compiler can't guarantee that it is uninitialised. If your code is so interdependent then this suggests that you probably need to refactor the code where possible.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
<blockquote class="FQ"><div class="FQA">Pete O`Hanlon wrote:</div>If your code is so interdependent then this suggests that you probably need to refactor the code where possible</blockquote>
Thanks Pete, but I'm not sure how to apply the refactoring approach. The object instance of SampleClass will be passed to other objects yielding object composition. So quite a few lines of code depend on 's'.
public class Tester
{
class Program
{
static void Main(string[] args)
{
SampleClass s;
try
{
s = new SampleClass(20, 20);
}
catch (Exception e)
{
// Do processing here.
}
A1Class a1 = new A1Class(s);
A2Class a2 = new A2Class(s);
//...
AnClass an = new AnClass(s);
}
}
}
|
|
|
|
|
Is there some reason that your classes A1Class, etc..., aren't inside the try/catch block. I can see no reason why you couldn't do that.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Good point, Pete! I haven't thought of that as there is lots of preprocessing to do in order to setup classes A1Class, A2Class,...
But I could easily do the preprocessing first and at a later stage initialise an object of SampleClass and create the various other objects within the try block.
Thanks for helping me out.
Goebel
|
|
|
|
|
public class Tester
{
class Program
{
static void Main(string[] args)
{
SampleClass s = null;
try
{
s = new SampleClass(20, 20);
}
catch (Exception e)
{
s = null;
}
if( s != null )
{
s.Action();
}
}
}
}
This version should do the trick.
Regards,
Tim
|
|
|
|
|
Thanks Tim. Your approach made me think of something else. So far there is no SampleClass default constructor. But I could provide one resulting in a valid object initialisation. In doing so we'd guarantee that there is an object of type SampleClass. Thereby I could avoid checking for null-reference whenever I use 's'. Is that too much of a workaround?
public class SampleClass
{
public SampleClass()
{
this.param1 = 1;
this.param2 = 1;
}
public SampleClass(int param1, int param2)
{
int param1;
int param2;
if (param1 % param2 != 0)
{
throw new Exception();
}
this.param1 = param1;
this.param2 = param2;
}
public void Action()
{
// Some weird stuff in here.
}
}
public class Tester
{
class Program
{
static void Main(string[] args)
{
SampleClass s = new SampleClass();
try
{
s = new SampleClass(20, 20);
}
catch (Exception e)
{
// Do processing here.
}
s.Action();
}
}
}
Thanks again,
Goebel
|
|
|
|
|
If you provide a default constructor, I would recommend not to use a second constructor for your purpose. Instead provide a method.
Currently you assign a new object within the try/catch-block and I'm not sure what happens to s , if an exception is thrown within the second constructor.
Goebel wrote:
public class SampleClass
{
public SampleClass()
{
this.param1 = 1;
this.param2 = 1;
}
public Assign(int param1, int param2)
{
int param1;
int param2;
if (param1 % param2 != 0)
{
throw new Exception();
}
this.param1 = param1;
this.param2 = param2;
}
public void Action()
{
}
}
public class Tester
{
class Program
{
static void Main(string[] args)
{
SampleClass s = new SampleClass();
try
{
s.Assign(20, 20);
}
catch (Exception e)
{
}
s.Action();
}
}
}
Regards,
Tim
|
|
|
|
|
Very good, got that.
Things are a lot clearer now!
Thanks.
Goebel
|
|
|
|
|
It is not a bug, only a good warning
do this: SampleClass s = null;
|
|
|
|
|
The error you are getting is simply the compiler warning you that you are using a variable that may not be explicitly initialized during runtime depending which path the execution flow takes.
In your case, you are using an uninitialised variable named s. The compiler is simply detecting that the execution might reach the catch and finally blocks with s never being explicitly initialized in your code and will therefore warn you because it's not sure if you know what you're doing (in your code this would happen if your class constructor throws an exception).
On the other hand, if you explicitly initialize the variable s to null, which makes no difference at runtime to what you originally coded, the compiler understands that you know what you are doing and that you have factored in the possibility of s being null if the catch and finally blocks are ever executed.
Please note that this is not something specific to try catch-blocks and constructors. You would get the same error in the following code (the code does not make much sense at all but its a valid example):
public void example(bool dummy)
{
myClass s;
if (dummy)
{
s = new myClass();
}
else
{
if (s==null)
else
}
}
Hope this clears it up a little for you.
P.D. About the default constructor, C# does not work the same as C++. Having a default constructor will not make your variable s use it when its defined:
myClass s; //this will not call the default constructor as in C++. C# initializes objects to null.
Please note that the compiler error is not really necessary as the s variable is truely null even if not explicitly initialized and will therefore not cause unexpected behaviour reading uninitialised memory, etc. Its more an aid and a reminder to the coder that might be overlooking a possible execution path where the variable may not have the expected value. This becomes evident if instead of using your class you try your same code with int s; You will still get exactly the same error even though s is by default initialized to 0 and has a perfectly valid value.
-- modified at 13:11 Monday 7th May, 2007
|
|
|
|
|
Hi Every one
while iam parsing one file my output file looks like this:
1aDOCSTART_3:
GENEVAVERSION:5.0
BILLSTYLE:2
BILLTYPE:1
BILLTEMPLATE:3
BILLSEQ:1
BILLVERSION:1
ACCCURRENCYCODE:GBP
BILLLANGID:1
BILLLANGNAME:English
BILLLANGLOCALE:en_GB
PAYMETHODID:4
FORMATREQ:TEST014/0001
COPYBILLNUM
BILLPURPOSE:1
BILLPURPOSENAME:Master
ADDRESS1:11
ADDRESS4:London
ZIPCODE:SW1V
COUNTRY:United
Start of BSTARTACCFADDR
ACCFADDR_1:11
ACCFADDR_2:London
ACCFADDR_3:SW1V
ACCFADDR_4:United
End of theBENDACCFADDR
CUSTOMERREF:TEST014
CUSTOMERTYPE:UK
ACCTAXSTATUS:Exclusive
INVOICINGCONAME:Genie
ACCOUNTNO:TEST014
DEPOSIT:000
CUSTCONTACTADDR1:11
CUSTCONTACTADDR4:London
CUSTCONTACTZIP:SW1V
CUSTCONTACTCOUNTRY:United
Start of BSTARTCUSTFADDR
CUSTFADDR_1:11
CUSTFADDR_2:London
CUSTFADDR_3:SW1V
CUSTFADDR_4:United
End of theBENDCUSTFADDR
i want to show this data as xml output.pls any one give me solution for this.
it is more helpful for me.
Thanks&Regards
RENU
|
|
|
|