Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
Hello, I have a job to do for a company that I have users and tickets management and stood in a part and can not progress, so I decided to come ask for your help. What I want is to log in and users of unregistered shares in C # and all the parts of administration and supervision in ASP.net, the problem is that I do not know how can i make the connection between C # and ASP.net, indeed I do not know if it is possible to do so. What I ask is that if you can tell me and teach me some clue how to get to that I want, I have no code about it, i tried but i didnt reach the goal, but the idea is explained above.
ty in advance
Posted 3-Jul-12 0:51am
Comments
perilbrain at 3-Jul-12 5:58am
   
wasn't this link http://asp.net-tutorials.com/basics/code-behind/ a thing of your concern ???
Zoltán Zörgő at 3-Jul-12 5:59am
   
As ASP.NET is a web framework + platform over .NET CLR, C# is a .NET language and you can do ASP.NET in C#.
What is the exact problem?
Zoltán Zörgő at 3-Jul-12 6:08am
   
You want to interact with an asp.net web forms application from a windows forms application?
Paulo Jorge Arteiro Soares at 3-Jul-12 6:37am
   
yes i want to interact 2 projects one in c# and another in asp.net
Sergey Alexandrovich Kryukov at 3-Jul-12 15:35pm
   
Makes no sense as formulated. Perhaps you should start from you ultimate goals, not focusing on your idea how to achieve it.
--SA
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

What i understood from the question is that you want to know whether it is possible to use ASP.NET and some existing C# code in unison.
 
ASP.NET websites actually use C# as the programming language(VB is also a choice)
 
ASP.NET does the scripting part which will will be translated to the respective HTML by the framework. the actual business logic is mostly written in C#.
 
So you can wrap your existing C# code in some logical classes that makes sense as per the application domain and perhaps put it inside a class library. You can use this class library from a ASP.NET website just by adding reference to it.
 
I hope my understanding of the question is correct. If not please let me know and I will try to refine the answer.
  Permalink  
Comments
Paulo Jorge Arteiro Soares at 3-Jul-12 6:20am
   
i'll try to give more detailed information with an example:
i have a login (made in c#) and another form to change password when i get in the application for the first time (also in c#)
then if the user is correct, there is a profile validation, so if its a normal user (with basic functions) it appears another form (in c#) when is an administrator, it appears a page in asp.net so my doubt is how to connect c# to asp.net, do i have to put an hiperlink?
Rahul Rajat Singh at 3-Jul-12 6:23am
   
the forms that you are talking about. are they WINFORMS. because it seems whenever you are using word made in C#, you are actually trying to say a winform page. Am I right?
Paulo Jorge Arteiro Soares at 3-Jul-12 6:38am
   
the forms that im talking about are windows form, it can be done in wpf too but windows form are good for what is needed
Paulo Jorge Arteiro Soares at 3-Jul-12 6:23am
   
and another thing i did the asp.net pages in another project, is it wrong? :/ if it was in the same project it wasnt difficult
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

As ASP.NET is a web framework and platform over .NET CLR, and C# is a .NET language and you can do ASP.NET in C#, you better say web application and windows application, because you might confuse one. According to your clarification, you want to control (kind of) a web application from a windows application.
A) The best way would be to publish web services or wcf services and consume them from the windows applications.
If you can't add this feature, you can exchange data between the two applications in following ways:
B1) Automate a browser (Internet Explorer) via COM - you will have to code interfaces
B2) Use WebBrowser control - but you have to code browser functions
C) Use HttpClient class - there is noting visible, you have to simulate the browser actions and the logic of the client side code
D) Some other IPC - even more to code
  Permalink  
v2
Comments
Paulo Jorge Arteiro Soares at 3-Jul-12 8:31am
   
ty very much for your help, it helped me understand and im stating to search more about WCF
ty :)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Separate answer to avoid clutter:
 
To open a ASP.NET website from a windows application:
 
1. If the website is already hosted on a public server
 
ProcessStartInfo sInfo = new ProcessStartInfo("http://something.com/default.aspx");  
Process.Start(sInfo);
 
2. If it is on the same machine
----a. configure the site inside a vitual directory in IIS ( say mysite )
----b. do this
ProcessStartInfo sInfo = new ProcessStartInfo("http://localhost/mysite/default.aspx");  
Process.Start(sInfo);
I hope you will get things to work with this. if not do let me know and I will try to see what i can do.
  Permalink  
Comments
Paulo Jorge Arteiro Soares at 5-Jul-12 9:12am
   
ty very much i'll try this

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 6,055
1 DamithSL 4,621
2 Maciej Los 4,087
3 Kornfeld Eliyahu Peter 3,500
4 Sergey Alexandrovich Kryukov 3,294


Advertise | Privacy | Mobile
Web02 | 2.8.141220.1 | Last Updated 4 Jul 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100