PeteT
PeteT

Reputation: 19180

Put ASP.NET on wordpress site

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.

Upvotes: 6

Views: 30347

Answers (10)

Bengi Besceli
Bengi Besceli

Reputation: 3748

I can be able to use both Asp.Net and Wordpress on my Host (Dinamo.net.tr) without using any plugin or iframe.

They can really work together, you just upload your Asp.Net C# files, and install Wordpress at the same time.

Upvotes: 0

ablaze
ablaze

Reputation: 722

I am exploring http://sourceforge.net/projects/wordpressnet/ if it helps anyone ...

Also,


I know it is an old post and I too do not prefer necroposting but these resources may improve the existing content.

Upvotes: 1

GNat
GNat

Reputation: 475

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 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.

Upvotes: 6

PeteT
PeteT

Reputation: 19180

Since asking this question a long time ago and creating a less than ideal iframe solution I have now found a great wordpress plugin called iframe-less

http://wordpress.org/extend/plugins/iframe-less-plugin/

Basically you give it an URL and it builds the content of that page directly into your wordpress page. So far it seems to work really well.

Upvotes: 9

MGOwen
MGOwen

Reputation: 7329

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.

Upvotes: 1

PeteT
PeteT

Reputation: 19180

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).

Upvotes: 3

bzlm
bzlm

Reputation: 9727

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.

Upvotes: 0

RickNZ
RickNZ

Reputation: 18652

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....

Upvotes: 1

Vladimir Kocjancic
Vladimir Kocjancic

Reputation: 1842

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.

Upvotes: 5

Anuraj
Anuraj

Reputation: 19618

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.

Upvotes: 0

Related Questions