passing Guid values from C# object to ASP classic?

J

jason

Hello everyone,

I have a C# object library which encapsulates data. Data is keyed by
way of Guid values, which are stored in the objects as read-only Guid
properties.

However, we have a Classic ASP application that has to read these Guid
values, and sometimes pass them back into the the object libraries (for
LoadByID type functions).

The library itself works through COM Interop just fine, but how do you
recommend I pass the Guid value back and forth? Can the ASP Classic
instantiate a COM object that will hold a .NET Guid?

One thing I've tried is using the .ToString method to get it out to the
ASP app, but if the ASP passes a string back into the object library,
how do I assign the value of the Guid from a string? I haven't seen any
methods to suggest that is possible.

Thanks for any help,

Jason
 
N

Nicholas Paldino [.NET/C# MVP]

Jason,

The constructor of the Guid structure takes a string (in a specified
format) which can initialize the Guid with the value.

Passing a string here is the better solution (although I don't like it),
since ASP isn't going to be able to access the structures in .NET (it is all
late bound, and I don't believe you can access structures in late bound
environments).

Hope this helps.
 
J

jason

indeed, i just noticed the string constructor of the Guid. thanks so
much for responding!

this is going to be such a pain in the ass. i can't wait until the ASP
Classic goes away. i'm going to have to make special ASP Classic
versions of all the Guid properties now, that get and set to and from
strings. wee, fun :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top