views:

322

answers:

7

I work for a college and our main website has an ASP.NET based course information search which I created. This has become popular and our company facing website (training for companies) has asked for the same system on their website. I'm not involved in the day to day of either website but know theirs was made using Wordpress. Is it going to be possible for me to embed some ASP.NET code within some of the pages? Any articles on doing this?

EDIT: The ASP.NET code that would appear in the actual Markup is minimal it's mainly a few asp:Literals I did this on purpose to hide most of it from the website developer to save myself hassle when something gets deleted by accident.

EDIT2 There was a response to do it as a webservice would this be possible. i.e. as search box on the main page displaying the results underneath.

A: 

WordPress is a LAMP(Linux Apache MySQL PHP) application, and normally running in Linux servers. I don't think you can integrate ASP.Net to wordpress. But off course you can provide link to ASP.Net application from WordPress.

Anuraj
A: 

What you could do is create a web service on your ASP.NET application and then write a Wordpress plugin, that would read that service and display it in wordpress page.

Vladimir Kocjancic
Sounds interesting so I edited my post to see what others think. Webservices is not something I have done before just researching now as far as I can tell implementing the service ASP.NET side would be relatively easy. I don't know about putting the SOAP tags on the wordpress page though.
PeteT
+1  A: 

Wordpress uses PHP and MySql. I have successfully installed and run it under Windows 2008 with IIS 7. The new CGI stuff in IIS 7 results in pretty good performance, too.

You can of course run a separate but related ASP.NET-based site on the same server.

You can also run a mixed ASP.NET + PHP site. IIS directs incoming requests to a particular HttpHandler based on the extension of the URL, so there's no reason why you can't mix *.php & *.aspx.

In fact, you can also do things like write a .NET-based HttpModule that integrates with a PHP/IIS site, to do things like logging, centralized cookie management, HTTP header "adjusting", etc.

If you want to put ASP.NET controls in a *.php file, that's a different thing entirely. To do that, you would need to write an HttpHandler that understood how to parse such a file. Either that, or just use iframes....

RickNZ
Doesn't need to be that complicated. Just enable both PHP and ASP.NET for the IIS web site.
bzlm
What do you mean "that complicated"?
RickNZ
@RickNZ - it sounds to me like petebob796 is pretty new to web development, you should probably add a caveat that this is kind of a difficult and advanced thing to attempt for someone who didn't even know that you couldn't simply put some asp.net code into a wordpress page and php would run it.
MGOwen
A: 

No, this won't work. You cannot use ASP.NET on pages that are served by WordPress. You can use ASP.NET in the same web site as Wordpress, for example by having certain directories or certain pages serve ASP.NET content, while the rest of the site still serves WordPress content.

However, if the ASP.NET code you wish to use is very simple, why not do it in PHP instead? WordPress uses PHP, which is very similar to ASP.NET.

bzlm
A: 

This wasn't ideal but the solution I produced involved using IFrames which are still in the HTML 5 spec (infact they have some new attributes) so I think I am ok. Basically I make a page in wordpress with an IFrame and some javascript on its onload to make the iframe resize automatically based on the content size using the code below (iframe called frame with width 100 percent).

function autoIframe(){
    try
    {
        var page_height = document.getElementById('frame').contentWindow.document.body.scrollHeight;
        document.getElementById('frame').height = page_height+60;
    }
    catch (err)
    {
        window.status = err.message;
    }
}

This code will resize on loading of the first content, if the content changes it will need to be called in someway. My solution was to call the method from the innerpage using parent.autoIFrame() each time a search was done.

p.s. The javascript will only work if the iframe and outer page are from the same domain (No cross site scripting).

PeteT
A: 

Short answer: no, not easily. Wordpress is PHP - you can't just put some .net code on a PHP page.

Long answer: yes, if... if you are really keen to do this, and it's worth the time and effort, you can work around it by using some of the strategies suggested already, e.g.: host the ASP.NET bit on a windows server (or use mono) and show it inside an iframe on the wordpress page.

Just bare in mind that this is not a common setup, and may be more difficult than simply creating or using some kind of Wordpress plugin.

MGOwen
A: 

I have similar needs that the originator of this thread has. I maintain a CRM and corporate site that runs on ASP.NET/SQL along with a separate Wordpress php company blog. After we've been using Wordpress for a year, people here would love to be able to edit static content on our corporate site like we do in Wordpress, so I am looking at possible ASP.NET/Wordpress hybrid set ups.

I am hearing good things about "Phalanger": http://www.php-compiler.net/doku.php It is a PHP Language Compiler for the .NET Framework, and you can run PHP code in .NET

It was also great to find out in this thread that you can have PHP and ASP.NET in the same IIS web, its another reasonable sounding solution. If I had any nay reputation (I am new here) I'd give RickNZ a vote.

Gnatp