C# - Pass Object From Webserver To Client?

Jun 9, 2010

I developed a C# web application that calls a web-service which returns a base64 encoded array (PDF file). I then convert that array into a UCOMIStream object (I know it is obsolete, but the DLL that I am using requires it as a parameter). I use the following code to do the conversion which works perfectly. I can pass this object to the DLL so that I can print the PDF.

This works great on the Webserver, but the requirement is to print it locally.

Byte[] bBuffer = statementOut.statementcycle.statementdata.content;
int size = bBuffer.Length;
IntPtr mem = Marshal.AllocHGlobal(size);
Marshal.Copy(bBuffer, 0, mem, size);
// Create an OLE Stream object.
System.Runtime.InteropServices.UCOMIStream str; //obsolete but the createstreamonhglobal outputs it
CreateStreamOnHGlobal(mem, true, out str);

The DLL resides on the client so I am able to use ActiveX to create the object using javascript and/or VBscript;however, I have not been able to figure out how to get the stream object to the client to pass to the DLL.

View 2 Replies


Similar Messages:

Allow Client Pass My Object Through Webservice?

Nov 12, 2010

I want to write a webservice, and in one of its methods, I want user to pass one my object's instance as parameter. It will greatly reduces number of parameters, and help user call this method more effectively. I create some class, but when distributing them to client, only class name remains, all properties and methods are gone, just like this

public class CameraPackages
{
private readonly List<CameraPackage> _packages;
public CameraPackages()
{
_packages = new List<CameraPackage>();
}
public void AddNewCamera(CameraPackage package)
{
_packages.Add(package);
}
public void RemoveCamera(CameraPackage package)
{
if(_packages.Contains(package))
_packages.Remove(package);
else
throw new ArgumentException();
}
}
into this: (in Reference.cs)
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "2.0.50727.3082")]
[System.SerializableAttribute()]
[System.Diagnostics.DebuggerStepThroughAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://tempuri.org/")]
public partial class CameraPackages {
}

How can I do to allow user use my object?

View 1 Replies

MVC :: How To Pass JSON Object As Dictionary Object

Oct 23, 2010

In MVC3 Beta version i have action result same like

public ActionResult Save(Dictionary<string, string> dicObject)

I want to pass JSON Object in POST Method from javascript and need to get as dictionary object

How can i do this? can you write example if possible?

View 5 Replies

Pass Data Between Forms - Error "Object Reference Not Set To An Instance Of An Object"

Mar 3, 2010

i am trying to pass data between forms.

Public selected_Month As String
Public Property Month() As String
Get
Return selected_Month
End Get
Set(ByVal value As String)
selected_Month = value
End Set
End Property

form1: where i am assigning a value

Dim my_Class As New Class1
my_Class.Month = ddl_Month.Text.ToString()
form2: where i am geting a value
Dim my_Class2 As New Class1
MessageBox.Show(my_Class2.Month.ToString())

when i run this code, i am getting error like Object reference not set to an instance of an object.

View 6 Replies

C# - Can Pass A .net Object Via Querystring

Jan 25, 2011

I stucked at a condition , where i need to share values between the pages. I want to share value from Codebehind via little or no javascript. I already have a question here on SO , but using JS. Still did'nt got any result so another approach i am asking.

So I want to know can i pass any .net object in query string. SO that i can unbox it on other end conveniently.

Update

Or is there any JavaScript approach, by passing it to windows modal dialog. or something like that.

What I am doing

What i was doing is that on my parent page load. I am extracting the properties from my class that has values fetched from db. and put it in a Session["mySession"]. Some thing like this.

Session["mySession"] = myClass.myStatus which is List<int>;

Now on one my event that checkbox click event from client side, i am opening a popup. and on its page load, extracting the list and filling the checkbox list on the child page.

Now from here user can modify its selection and close this page. Close is done via a button called save , on which i am iterating through the checked items and again sending it in Session["mySession"].

But the problem is here , when ever i again click on radio button to view the updated values , it displays the previous one. That is , If my total count of list is 3 from the db, and after modification it is 1. After reopening it still displays 3 instead of 1.

View 5 Replies

C# - Pass In An Object When Using An IoC Container?

Mar 8, 2011

I am doing a project in ASP.NET MVC in which I want to implement an IoC container. I am new to IoC containers and have been searching to find a solution to my problem, but so far to no avail.

The problem is dat data is distributed across various databases. Once a user is logged in, the database for the user is retrieved from an authorization database and then set in the user session. That user session is passed on to the services and repositories when they are constructed, so they can use it when they need it to access the database.

A typical bare stripped service (without interfaces and ioc) looks like this:

private CompetitionRepository _CompetitionRepo;
public CompetitionService(DataContext dataContext)
: this (new CompetitionRepository(dataContext))
{ }

[code]...

The "DataContext" contains a couple of properties with which the correct database is selected for the session. Because the Services and Repositories don't have access to the session itself (which is outside of their scope) they need this object.

View 1 Replies

Pass Array To Client Side For Display?

Mar 20, 2010

I have an array which contains around 50-200 hyperlinks. How can I pass this array to the client-side so that I can iterate through the array and display each hyperlinks as a list item?
The array will be stored in 'Application' as it's system wide and rarely changes. Could there be a more efficient way of achieving the hyperlinks as a list?

View 5 Replies

How To Pass Client Id Of Item In Repeater To Javascript

Jan 25, 2011

I need to pass div client id to JavaScript of a repeater

I have 3 divs inside a repeater i have onmouseover event i want to grab client id of div element Is there any way i can pass exact client of div element

View 2 Replies

How To Pass Value Object Class Dynamically

Jul 14, 2010

i have 10 classes and i want to send the class in a paramenter dynamically to call a method for example int addmember(aslogic.base obj) smilary i want to pass class in the parameter.

View 4 Replies

WCF / ASMX :: How To Pass Object To Web Service

Nov 4, 2010

I'd like to pass an object (Digital Persona featureset) to a web service. Can't seem to find a good way to serialize it.

View 4 Replies

MVC :: Pass Object From Action To View

Jan 20, 2011

I have the following action executed when a user selects an item from the dropdown;

[Code]....

The object paymentApplicationRefund is populated. I want to get the contents of this object to put in a Html.Textbox(). How do I proceed??

View 11 Replies

MVC :: Aggregate Object Pass As A Hidden Value?

Sep 16, 2010

How to use Html.Hidden for aggregate object?
For Example, I have Model1 which aggregates Model2.

Model:
class Model1
{..
public Model2 model2;
..
}
class Model2

[Code]....

View 2 Replies

MVC :: Pass Javascript Object Value To Controller?

Feb 9, 2010

Consider the following data

<xml>
<id>10</id>
<value1>15<value1>
</xml>

I need to use this data as an input to ajax request. For eg. consider a dropdownlist change event, I need to pass these values to the controller.

sample code

//dropdown change event
$("#TestReqID").change(function() {
var id = 10;
var testResults = "abc";
var inXML = "<xml>";
inXML = inXML + "<id>" + id + "</id>";
inXML = inXML + "<value1>" + testResults + "</value1>";
inXML = inXML + "</xml>"
$.getJSON("/Home/UpdateTest/Json/" + inXML, function(data) {
//success code goes here
});
});

in HomeController

public ActionResult UpdateTest(string obj)
{
if (HttpContext.Request.IsAjaxRequest())
{
/*
Need to parse data in "obj" from ajax request
*/
IPTests test = _service.GetIPTest(Convert.ToInt32(id));
return new JsonResult { Data = new { ipTestId = "0", testResults = "" } };
}
return View(test);
}

instead of xml string is it possible to use javascript object like

[Code]....

View 2 Replies

Pass A Sql Connection Object By Reference?

Mar 7, 2011

using vb.net/asp.net 2005.

I am trying to pass a sql connection object by reference ("ByRef") like so but when I'm inside the function that i'm passing it to it sees the connection as closed, what am i doing wrong?

[Code]....

View 1 Replies

AJAX :: How To Pass An ID Of A Control To Client Side Function

Aug 4, 2010

In a GridView, I am using ItemTemplate section for multiple editing. I am using ClientValidationFunction property of MaskedEditExtender to run a client side function. Let's call it MyClientFunction . How can I pass an ID of a control found in the gridview row to my MyClientFunction?

I know how to do it via RowDataBound as follows: Is there a way to wire it up in ClientValidationFunction property?

Dim NewDte As TextBox
Dim PrvDte As Label
NewDte = CType(e.Row.FindControl("EditReadingDate"), TextBox)
PrvDte = CType(e.Row.FindControl("lblEditLstRdgDte"), Label)
NewDte.Attributes.Add("onkeyup", "javascript:ChkDteMultiple('" & PrvDte.ClientID & "')")

View 9 Replies

WCF / ASMX ::pass Xml Document To A Method In WCF Service By Client?

Aug 2, 2010

I would like to pass xml document to a method in WCF service by client that server will get xmldocument,parse it and send back the xml response.What are best practice for thi?The xml document is conform to XSD so i would like to create managed type that represent the schema and then expose thatIf anybody has done it before or know any example please point it out so i can see it.

View 1 Replies

Can Pass An Object Between Separated Applications By Web Service

Dec 26, 2010

I have a web service Writed By VB.net Lang return a DataSet Contain many rows , I tried to Call this Web Service From Java applicationput Java Language cant Deal with dataSet , So I need to Convert the Dataset to an Object

<WebMethod()> _
Public Function GetLogBook(ByVal EmployeeNumber As String, _
ByVal EmployeeName As String) As DataSet
Dim ds As New DataSet
Dim conn As New
[code]...

View 3 Replies

WCF / ASMX :: Can Pass Object In Rest Service Uri

Jan 18, 2011

can Pass object in Rest Service Uri

View 1 Replies

How To Pass 'user' Object From Aspx To Silverlight 4

Dec 28, 2010

First, we are constrained to using an existing web framework that handles authentication and authorization. The web project uses forms authentication and writes to an encrypted cookie. The user information is exposed to the aspx pages as a property:

LoggedInUser.Current

This has several properties including the userId and role list.

I've looked at using initParams, but haven't been very successful there (edit: I couldn't do it dynamically originally). I've created a simple POCO entity with a [Key] attribute, but I need to at least be able to pass the userId from the aspx page to the imbedded silverlight.

What is the easiest way to pass a dynamic object from aspx to silverlight 4?

[Code]....

Then used Slugster's example to use the values on the Silverlight side.

Warning: Passing user information via init params exposes the info as plain text to the user viewing the page (they just have to view the source). We ended up using an authentication domain service and using the same user object as the aspx

View 2 Replies

Web Forms :: Pass Additional Parameter Into Client Validation Function?

May 19, 2010

I'm using a CustomValidator control to validate some controls in a GridView. I have the validation working perfectly on the client and the server, but would ideally like to pass the GridView ID into the client function so I can move it out into a separate

.js file. The signature for my client function is:

function valOrder_ClientValidate(source, args) { // Code here}

And my CustomValidator control looks like:

[Code]....

Is there a way I can pass an additional parameter into this function?

View 4 Replies

WCF / ASMX :: Writing A Dataset Recordset To A Stream To Pass To Client?

Mar 3, 2011

I have run into the issue on DataSet.WriteXml method. Apparently, if any row in a column in the DataSet has a null value, the entire column/rows will not write out in the xml file using the method DataSet.WriteXml. So, as terrible as that bug is, I need to send the data another way. Does anyone have any thoughts?

View 4 Replies

DataSource Controls :: Pass Object As SessionParameter In ObjectDataSource?

Dec 28, 2010

Is it possible to pass a domain object as session parameter in an ObjectDataSource. I'm doing this:

<asp:ObjectDataSource ID="ParticipantsDataSource" runat="server" OnInit="SqlDataSource_Load"
SelectMethod="LoadParticipants" TypeName="SB.Web.units.Players">
<SelectParameters>
<asp:SessionParameter Name="user" SessionField="User" Type="SB.BusinessLogic.DomainEntity.User" />
</SelectParameters>
</asp:ObjectDataSource>

But I get the error message that I can't create an object of the type System.TypeCode from the string containing SB.BusinessLogic.DomainEntity.User for the property Type.

View 1 Replies

Security :: Pass Membership Identity Object Across Domain?

Aug 20, 2010

I am trying to figure a way to SSO with ASP.NET membership and role model.

I can implement custom membership provider which consume web services hosting on a server.

With encryption of data. No problem.

But my question is, If I sign on a website with my provider, got my identity object on that application,

could I pass it to another website on another domain which use the same provider and by doing so, do not need to login again?

View 2 Replies

Data Controls :: Pass Generic List As A Message From Server To Client

Sep 9, 2013

im just testing out signalr and i am having too much fun and got a little bit far from my usual skill now my question is can i pass a list to the client here is my code actually i learned this from you mr aspsinnipets

Public Sub Send(message As String, id As String)
Dim tomessage = OnlineUser.userObj.Where(Function(users) users.userId = id).[Select](Function(users) users.connectionId).SingleOrDefault()
Dim customers As New List(Of locationslist)
customers.Add(New locationslist)
customers((customers.Count - 1)).CITE_NR = message

[code]....

View 1 Replies

Pass Key Of Grid To Business Class Via Object Data Source?

Sep 15, 2010

In ASP.NET Webforms have an ASP.NET GridView connected to a C# class via an object data source

I have an ID set up as a DataKeyName in the grid. How do I pass this to the C# class when I update the grid?

View 15 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved