Connecting C# Back-end with PHP frontend - c#

I have a code written in C# I would like to use as the back-end of a site I'm building.
I would prefer not to build the site front-end in ASP.NET (which integrates nicely with C#), and to use PHP or Python instead.
Is that reasonable? Should I re-consider using ASP.NET?
How can I achieve that?

Just use asp.net mvc framework for the frontend instead of plain asp.net. It's easy to learn. And if you know php it will be easy to you undestand asp.net mvc.
I don't see the reasons if you are using c# backend use php frontend. For sure you can create service layer on c# and communicate with php through it, but it does not make sence for me.

You can do whatever you like. Personally i wouldnt use php because i dont know very much php.
But you can do it, you could expose a soap web service and there are libraries that will let php talk to it.
No one here will be able to tell you what you haven't already told us. Asp.Net will probably be easier because of how everything integrates and you can share classes etc - but that does not mean you HAVE to use it.
Both of them are fairly passive server side technologies that present html to browsers though. why do you need 2 servers?
You have to ask why you are doing it .. if you are playing and want to learn then of course you can do it just to see how it all works. But if you are on a commercial project then id suggest that you dont need both a php and a c# server ... or if you do perhaps you want to go asp.net for your web server and if you need another layer of services behind then use WCF if you want to go a microsoft route. Howver it is usually possible to host all services in the same IIs instance.

You can do this i have done this for a web site my self use a database server or files,
http://dtpgroup.co.uk/
Your C# application can connection to your store save the info it needs to then php can read them if it file just use a formatted file E.G
if your using Database php can connect to MySQL or MSSQL so your C# application can use MySQL if you know what your doing in C# if not and your more comfortable in php then use MSSQL (also php have the superior documentation )
I work in both frequently

Ugh, in normal instances, reading data with C# writing it to files and loading up with PHP sound slow, inefficient and down wright crazy. I believe these terms are being used wrongly.
Client Server - user machine - database great for private networks where you connect to the DB without going over the internet
vs n-Tier
Client - Browser programming html, css, javascript connects to middleware over the internet
Middleware - inside your firewall, connects browser to database could be called part of backend - php and C# are middleware languages
Database final (generally 3rd) tier
With php and c# you are creating multiple middleware layers
why why why would you do this for a web app pick one
now if you have a web app with PHP and sneakerware in house client server apps that are controlled ie shipping, accounting that are not exposed - maybe but you have added complexity that you would not need (generally)
Gary

Related

What is a proper way to communicate from my website to the .NET (C#) and vice-versa?

I'm using CefSharp as a webbrowser framework in a Visual Studio C# Form application project.
I read in the CefSharp documentation that I can communicate from the .NET to my website using CefSharp Javascript Injection.
chromeBrowser.ExecuteScriptAsync("document.body.style.background = 'red';");
This line of code will change the background of my document to red.
I'm pretty sure this is not a proper way to establish a communication from the .NET to the website. (I would want for example to send data that the .NET project has to the website so the website can update the MySql database and this seems like a very fragile way to do it)
So I continued to google and I stumbled upon this. It says it
allows for communication between JavaScript and .Net.
Fair enough. I tried to read and understand what's going on but it's quite complex.
My question is: Is this the proper way to establish a communication from my website to the .NET project and from the .NET project to my website? Is there a simpler way?
The thing you've shown is just a communication between JavaScript and .NET
To actually communicate with the website you should use:
Web Sockets: Real-time communication between your server and client.
HTTP: You can use usual HTTP requests in C# to send requests and receive responses.
JavaScript: Run the JavaScript code that will request stuff with CefSharp tools.

C# silverlight application server

I am building an application that needs to connect to a server to send and retrieve data constantly.
at first i was going to use mysql, by mysql is far from what i want. using this would force users to connect to the database constantly.
CAN C# silverlight connect to a server and send a message?
here is an example to something in C# console, VERY similar to what i am trying to achieve
https://www.youtube.com/watch?v=9kcrTKj7Jpk
Any documentation would also be helpful.
To be more specific my server will be written with C# console, but i want my c# silverlight to send the message.
Yes.
CAN C# silverlight connect to a server and send a message?
Traditionally, the way that Silverlight has connected to a server to send a message is with WCF services. This still works well, but the other option is REST.
What you will need to do is write a layer (or use an ORM like Entity Framework) to persist data from whichever database platform you choose (MySQL or otherwise). Then you will need to write REST, or WCF services on top of this. You will then need to consume the services from your Silverlight application.
There are many articles on this if you Google. Here is one of the ones that comes up instantly:
http://www.dotnetcurry.com/ShowArticle.aspx?ID=228
One thing you must consider with Silverlight, is that by default, Silverlight will only talk to the server that the Xap package is hosted on. So, if you need the Silverlight app to talk to a different server, you will need to set up and expose a clientaccesspolixy.xml from the server where the WCF/REST services are hosted. This is a stupid limitation that Microsoft made a big mistake on in the first place. Here is an article about it:
https://msdn.microsoft.com/fr-fr/library/cc197955(v=vs.95).aspx

Google App Engine ASP.net

I am new to Google App Engine. What i really need to go is host my web service which is written in ASP.net & C# on google app engine.
My web service gets a string and translate that string from already stored translated values in the database which is SQL server 2008 R2. This translated string is in the form of spans. i then return the string.
thanks
The Google App Engine currently supports applications written in Python, Java and Go and won't run ASP.net applications unless some heavy magic (such as compiling it to Java bytecode) is involved and I'm not aware of anything that can do that specific trick.
Maybe you should consider Microsoft's Azure. It's kind of an equivalent PaaS solution, but will play with Microsoft's stack.
Note: Google has since added PHP support.
Note: Now Google has the "custom runtime" that allows you to host pretty much anything you can run on a Linux machine.
It should now be possible to host ASP.NET applications on App Engine. Use the custom runtime feature on App Engine and Microsoft's ASP.NET Docker image with your application. Also, you need to create a route for /_ah/health and respond with HTTP status code 200 and a blank message body (see lifecycle events).
You can not host C# applications.
Google App Engine is focused in supporting three application environments only: Java, Python and Go.
Additionally App Engine applications can also be written in any JVM-compatible language (e.g. JRuby, Groovy, Scala, etc.) and run in a Java 6 runtime environment.

Bluehost, Best way to run server

I have Bluehost account and the way I connect to the MySQL database and handle requests from remote devices is to use PHP scripts. I was wondering if I could run my server using C# instead of writing PHP scripts.
It doesn't look like Bluehost provides any support for C#. If you want to program web sites in C#, you need to look for a company that offers ASP.Net hosting.

Silverlight Security- Sensitive Data

Silverlight works on client side so putting any sensitive data like connection strings, passwords etc. in the code seems not to be a good thing. I want to build whole web app in Silverlight doing lots of authorization and database quering things. How to make it safe? Any tips&tricks and what things should I avoid?
I have never developed / used a silverlight app, but I would assume you would use a webservice to broker communication between your app and the database.
This is at least how Flex works.
Edit: This is how Silverlight works as well

Categories