.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Objects passed as parameters to a remote method call

Posted By:      Posted Date: September 28, 2010    Points: 0   Category :.NET Framework

This should be simple to lot of Remoting guru's out there Smile

1. How to pass business objects to remote method calls ??

2. Is it byref or byval ???

3. Does the object needs to implment ISerializable interface or have  an <Serializable> attribute ???

4. Does the object needs to inherit MarshalByRefObject ???

5. How to generate a proxy remote hosted on an IIS with binary formatting ???

6. Any pointers to web articles is greately appreciated !!

View Complete Post

More Related Resource Links

Remoting: Managing the Lifetime of Remote .NET Objects with Leasing and Sponsorship


Leasing and sponsorship is the solution for managing the lifecycle of a remote object in .NET. Each object has a lease that prevents the local garbage collector from destroying it, and most distributed applications rely upon leasing. There are several ways in which objects and clients can extend the lease, including dedicated sponsor objects. In this article, the author explains leasing, shows how to configure it, and how it relates to the various remoting activation models. He then discusses design guidelines and options, along with their impact on throughput and performance. Additionally, he introduces a helper class used to automate the management of lease sponsors.

Juval Lowy

MSDN Magazine December 2003

Problem with Finder method with parameters



Could someone explain me how to provide some value to the parameters in a finder method. For exemple I know that the BDC list WP use this method. Is there a way to provide some value for those parameter at runtime? I really don't understand (even after some deep search on the web) where are the values for the parameters from and how we can connect to them. Even with C# code I can't find any information on how it work.

I don't want to define my parameters as filter in the ADF because then I will have this filter section in my BDC list WP (or is there a way to get rid of that?). Actually one of the parameter should be automatically calculated from a value in a SP list, the other parameter should be provided by my own filter web part.

Thank you for your help.

The remote server returned an error: (405) Method Not Allowed.



{System.Net.WebException: The remote server returned an error: (405) Method Not Allowed.
   at System.Net.WebClient.UploadFile(Uri address, String method, String fileName)
   at System.Net.WebClient.UploadFile(Uri address, String fileName)
   at System.Net.WebClient.UploadFile(String address, String fileName)
   at Test.Page_Load(Object sender, EventArgs e) in c:\Inetpub\wwwroot\WebSite1\Test.aspx.cs:line 35}

Windows application, automated process will run on local user system...
trying to upload a file to website folder. website address:

System.Net.WebClient wc = new WebClient();
wc.UploadFile(website address, "c:/1.pdf");

Getting error from above line.. Am doing something wrong??
I dont want to use ftp or share folder logic..
is there any other way to upload the files to server??

Call a web method in Javascript


Hi All,

I am first time working on web service and Javascript and trying to call a Web Method (web service) on a button click in Javascript.

What I want to achieve is as followed: When the button is clicked, call the web method, get the return URL value and store it to a session variable, the redirect the page to another page. However, this works only when the internet traffic is fast, it give me error when internet is slow as the Javascript is executed much faster than the web service. Is there any way to handle this?  Would be much appreciated for your help! Cheers.

Code as below:


function emailButton_onClick()


function getCurrentMapURL(getCurrentMapURLOnSuccess)
var proxy_url = 'WebService/GPSWebService.asmx/GetCurrentMap';

var response = map.print([proxy_url]);



function getCurrentMapURLOnSuccess()
emailAddress = document.getElementById('txtEmailAddress').value;

if(emailAddress != null)
alert('Do you want to send report

Replication stored procedures not being passed parameters- default appears instead

Hi I am setting up transactional replication from Oracle to SQL Server, it is working fine for 9 tables, but for one it fails on updating and deleting with a message like this: Procedure or function 'spu_VGSM_SUBMISSION_CONTACT' expects parameter '@pkc1', which was not supplied. This is correct, in that the sp should be being passed this parameter, but when I do a trace it will show something like: exec "spd_VGSM_SUBMISSION_CONTACT" '12-3456-10','BLOGGS','S', '2010-07-01 12:43:43', 'M123456' default In other words, the old primary key values which should be being passed in are being replaced with "default". I am using the CALL syntax for the update sp. If anyone can suggest why this is I would be very grateful. This is the publication: exec sp_addpublication @publication = N'_Submission_Contact', @description = N'Transactional publication from Oracle Publisher.', @sync_method = N'concurrent_c', @retention = 0, @allow_push = N'true', @allow_pull = N'true', @allow_anonymous = N'false', @enabled_for_internet = N'false', @snapshot_in_defaultfolder = N'true', @compress_snapshot = N'false', @ftp_port = 21, @ftp_login = N'anonymous', @allow_subscription_copy = N'false', @add_to_active_directory = N'false', @repl_freq = N'continuous', @status = N'active', @independent_agent = N'true', @immediate_sync = N'

How to pass parameters from Application Main method to modules.

Hi , We created Prism WPF application.we have to pass some parameters(some information) to modules(they are instantiated by Bootstrapper) from Main method of App.xaml  Thanks in Advance.

WCF Basic Http Binding - Two server requests per method call

We have a service that uses BasicHttpBinding/Transport Security/Windows Authentication and is hosted in IIS. I have created a unit-test application in VSTS and whenever we test a WCF method, Fiddler records two calls. 1st call - No authorization token is sent. The WCF service returns a 401 error - Unauthorized: Access is denied. Http headers as sent in the request given below. POST http://localhost/AccountScreen.svc HTTP/1.1 Content-Type: text/xml; charset=utf-8 SOAPAction: "IAccountScreen/RetrieveAccountDetails" Host: localhost Content-Length: 243 Expect: 100-continue Connection: Keep-Alive 2nd call - Authorization token is sent and the WCF service returns the expected response. POST http://localhost/AccountScreen.svc HTTP/1.1 Content-Type: text/xml; charset=utf-8 SOAPAction: "IAccountScreen/RetrieveAccountDetails" Authorization: Negotiate Host: localhost Content-Length: 243 Expect: 100-continue I am not able to figure out why there are two calls made to the server in the first place and what is the significance of the first call. Any thoughts?

How to call CodeBehind Method from Client Side

Hi forumers,How can we call a CodeBehind Method with Arguement from Client Side?Here is the idea: this wont work<script type='text/javascript"> function func(){ var str = 'Hello World'; var result = '<% =CodeBehindFunction( str ) %>' } </script>I have a variable "str" and has a value of "Hello World".. I want to pass the value of "str" to the CodeBehind Method which is "CodeBehindFunction(object obj)"..How can I accomplish this idea without the use of XMLhttprequest, is it possible?

Passing Parameters to Web Service Method using XML DataSource

I would like to know how to pass parameter values to a web service that I am using as a data source.  I am using the Data Source Type XML.  I have been able to retrieve data back from the web service method that does not require parameters.  But I need to be able to use a web service that requires parameter values.  How do you use the XML data source type with parameters?  I have use information from the article  http://www.codeproject.com/KB/reporting-services/SSRS2005XML.aspx. thanks, Lloyd

window.XMLHttpRequest - Is it possible to call the Method which is present on the same page?

Dear Friends, I am using the below XML HTTP Request for checking the username whether already exist or not, What i am doing is i am opeing a page on xmlhttp.open("GET", "CheckUserNameSupportiveFile.aspx?UserName=" + username, true); And passing the username to check with database. if (window.XMLHttpRequest) { // code for all new browsers xmlhttp = new XMLHttpRequest(); }if (xmlhttp != null) { xmlhttp.onreadystatechange = state_Change; var adad = username = document.getElementById('<%=txtUserName.ClientID %>').value; // alert(adad); xmlhttp.open("GET", "CheckUserNameSupportiveFile.aspx?UserName=" + username, true); xmlhttp.send(null); }but what i want to do is, IS IT POSSIBLE WITHOUT CALLING ANOTHER PAGE [CheckUserNameSupportiveFile.aspx?UserName=" + username ] Can i check it on the same page itself by calling method OR something on the same page itself.I do not want to pass the value to another page on and check it with DB, i want to do in same page itself.All your suggestion / advice are welcome.

call a server side C# method from javascript

http://forums.asp.net/t/1591584.aspx Hi friends, can anyone provide me the C# code of the above post answer(pls go to the link)..i didnt understand the VB code... i dont know VB.. my problem also same.. i have a method in a class in App_Code folder... i want to call that method from javascript.. the method takes one parameter which is list box cotrol id... the list box control also available in the same page..   Please can anyone help me on this..

How to call a method with IDataObject in click event in wpf?

As I'm new in WPF development, I came up with a problem, looks like simple, however, I couldn't solve. The problem is, how to call a method with IDataObject in a click event?? I've a method like:  public void setProperty(IDataObject obj)         {                                      PropertyGrid mygrid = new PropertyGrid();                        UIElement elt = ExtractElement(obj);             Type t = elt.GetType();             string name = (string)t.GetProperty("Name").GetValue(elt, null);             mygrid.Instance = name;         } I want to call this method in a click event. I don't know how to. I've tried but couldn't yet. Any help will be appreciated regarding this. Thank you.   Regards, Binaya

How do I get the background color of a FrameworkElement passed into a method?

Hello, How do I get the background color of a FrameworkElement passed into a method? Here is the code: public static void SetEditability(FrameworkElement Control, bool IsEditable) { switch (System.Text.RegularExpressions.Regex.Match(Control.GetType().ToString(), @"\.(\w{1,})$").Groups[1].ToString()) { case "TextBox": SolidColorBrush scb = new SolidColorBrush(); scb.Color = Colors.White; // scb.Color = ((SolidColorBrush)((TextBox)Control).Background).Color; if (IsEditable) { ((TextBox)Control).IsReadOnly = false; scb.Opacity = 1; } else { ((TextBox)Control).IsReadOnly = true; scb.Opacity = 0.25; } ((TextBox)Control).Background = scb; break;   The code above works as seen.  But, I can't retain the background color because I can't get the background color from the passed in control (the commented out code above).  The color and opacity do change, just cannot get the color from the control.  How do I get it?  I've already tried several different ways, but I always get the following error: "NullReferenceException was unhandled Object reference not set to an instance of an object." I cannot test for null in this way "if (((SolidColorB

How write new method for .Net Objects

This might be a very basic question.Like thisDataRow1["ColumnName"].ToString();How can I DoDataRow1["ColumnName"].ToInt();I don't want to use Convert.ToInt / Have my own static Utitlity class and pass the value to it and get value.In  other words would I create new method  for .net objects?Thanks In advance

WPF method call between 2 Windows

I have a Window called MenuWindow and ControlWindow and I wanted the call a method void Sync() in ControlWindow from MenuWindow Im confused because i havent done this through 2 windows that were not the MainWindow. Normally i would do it like so ((MainWindow)Application.Current.MainWindow).Sync(); but how do i do it if its not the main Window?

dgw programmatically call a method

I have a method on a dataGridView, which is fully addressed like this: private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { //code }   I would like to access to this method programmatically, without mouse double click. And I have to pass a parameter of a row index. I have tried to pass an integer, but I got an error (cannot convert from 'int' to 'System.Windows.Forms.DataGridViewCellEventArgs), like: foreach (DataGridViewRow row in dataGridView1.Rows) { if (row.Cells[0].Value.ToString() == _myCellName) { dataGridView1.Rows[row.Index].Selected = true; dataGridView1_CellDoubleClick(null, row.Index); //here Im trying to pass a value for the upper method break; } }   When the upper method (dgw_CellDoubleClick) is programmatically called, I would like to call an "e", with: if(e.RowIndex > 0) { //code } So what to pass from to the method, that will work?

ILGenerator : call DynamicMethod with Emit method

A sample of what I try to do :     class Program     {         static void Main(string[] args)         {             GenerationIL();         }         public static void GenerationIL()         {             Action oDynamicMethod = DynamicMethod();             DynamicMethod dm = new DynamicMethod("Run", null, Type.EmptyTypes);             ILGenerator oILGenerator = dm.GetILGenerator();             oILGenerator.Emit(OpCodes.Call, oDynamicMethod.Method); // Runtime ERROR             oILGenerator.Emit(OpCodes.Ret);             ((Action)dm.CreateDelegate(typeof(Action))).Invoke();         }         public static Action DynamicMethod()         {             DynamicMethod dm = new DynamicMethod("Todo", null, Type.EmptyTypes);             ILGenerator oILGenerator = dm.GetILGenerator();          &nbs
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend