ASP to ASP.NET question

V

vbMark

Using previous ASP (not ASP.NET) I was able to pass off functions to COM
objects to do miscellaneous things.

Now, using ASP.NET, I want to pass off some work to a non-web program that
will do some work (access a SQL database, etc) and return the results.

Do I write a COM object in Visual Studio.NET to do this? What template?

Thanks.
 
D

David Browne

vbMark said:
Using previous ASP (not ASP.NET) I was able to pass off functions to COM
objects to do miscellaneous things.

Now, using ASP.NET, I want to pass off some work to a non-web program that
will do some work (access a SQL database, etc) and return the results.

Do I write a COM object in Visual Studio.NET to do this? What template?
NO. Don't write a COM object. Just write a class. You can add the class to
your web project and do whatever you want in it. If you have several
classes which you want to share among web projects, then you can add a new
class library project to your solution and put the classes in there.


A class like this:

MyClass.vb listing


option explicit
Class MyClass

shared function DoSomething() as string
return "Hello"
end function

end class

Would make DoSomething available to all the web pages in your project. Just
call

MyClass.DoSomething()

David
 
V

vbMark

NO. Don't write a COM object. Just write a class. You can add the
class to your web project and do whatever you want in it. If you have
several classes which you want to share among web projects, then you
can add a new class library project to your solution and put the
classes in there.


A class like this:

MyClass.vb listing


option explicit
Class MyClass

shared function DoSomething() as string
return "Hello"
end function

end class

Would make DoSomething available to all the web pages in your project.
Just call

MyClass.DoSomething()

David

Will a Class (written in C#) allow me to copy an image from a URL
location to the server's local hard drive if the path is passed from the
ASP.NET page?

Where could I find and example of downloading an image from a URL via C#
code?

Thanks again.
 
D

David Browne

vbMark said:
Will a Class (written in C#) allow me to copy an image from a URL
location to the server's local hard drive if the path is passed from the
ASP.NET page?

You can do practically anyting in a Class (written in C#).
Where could I find and example of downloading an image from a URL via C#
code?

System.Net.WebClient has a method already coded to do just that.



class util
{
public static void CopyImage(string url, string localPath)
{
System.Net.WebClient wc = new System.Net.WebClient(wc);
wc.DownloadFile(url,localpath);
}
}

David
 
K

Kevin Spencer

Check out the FREE Microsoft .Net SDK:

http://www.microsoft.com/downloads/...A6-3647-4070-9F41-A333C6B9181D&displaylang=en

ASP.Net isn't your dad's tired old scripting ISAPI. It is a fully-compiled
object-oriented programming technology which leverages the full power of the
..Net Common Language Runtime class library. It neither requires nor
interacts well with COM. However, it can do anything you can imagine without
COM, and better than COM.

Download the SDK and start learning what you can do with it!

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
C

Cowboy \(Gregory A. Beamer\) [MVP]

If the "application" in question is COM, you can include a reference. If
not, you can use the Process class, under System.Diagnostics, to run outside
processes (you can even start the process from this class).

Looking at the rest of the thread, you might not need to do this for what
you are desiring to do, but this is the way you run an outside program.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top