.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

How do I run php code with an html file by changing the web.config file?

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :Windows Application

I have a windows server and would like to add php code to my .html files. I know this is possible with linux servers with .htaccess files but how do I do it with a windows server? I called my hosting provider and they said I need to forget about .htaccess and look into the web.config file. What I want is for my server to read html files and execute any php code it finds. I can't find the code I need to add to the web.config file.

I am quite new to all this.  I switched my server to a windows server with IIS 7 a few months ago. But I find asp.net way too difficult for this beginner. I can't switch back to a linux server since my business partner is creating pages with ASP.net

I just want to execute php code inside of html files.  Any help is greatly appreciated, thank you.

View Complete Post

More Related Resource Links

Writing connection string in web.config file by code or dynamically

I want to write connection string in web.config file of my application by code. If anyone know the way or code just help me..NET,C#,SQL SERVER

How to dynamically create HTML file from the code ?

Hi all,Precisely and concisely, I have aspx page that has only one button "Generate". If the user clicked on this button, one HTML page should be created. The created HTML page should have title "Home" and the Body should contain "Hello World". 1) What is the code that should be written inside "Generate" button in order to accomplish this functionality? 2) Assuming the HTML page gets created, How to store it inside specific folder on the local drive? Or how to store it inside DB? I would greatly appreciate any constructive input!

changing config file after publishing


Is it ok to change the config file after publishing a site?  I use shared hosting.  

It would be nice to do things like change connection strings and smtp settings with out having to republish the site.

Code behind file changing


I have a code behind file which has only a few placeholders and literal. The gridview control and others are added in real time according to program conditions. I noticed that once in a while th eprogram stopped working because the .aspx file is changed  and some of the place holders disappeared - Why? (the bolded lines disappeared once in a while)



<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="DRProWebReport.aspx.cs" Inherits="DRProWeb.DRProWebReport" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

changing Asp.net Gridview's cell from Label to edit mode in code behined file


 Hi all,

In my asp.net application i'm using gridview to which i'm binding data dynamically by writing a select query in code behined file (all column's are autogenerated) now i want to change gridview cell to edit mode from label to textbox or dropdown on clicking of gridview's cell.How can i achive this in code behined file.

thanks in advance

Make sure that the class defined in this code file matches the 'inherits' attribute, and that it e


Here is the page directive for the page that throws the error:

@ Page language="c#" Inherits="University.AspNet.Index" CodeFile="Index.aspx.cs" %>

The code behind file Index.aspx.cs starts like this:

using University.Framework.UI;

namespace University.AspNet

public partial class Index : University.Framework.UI.HomePage

The code behind is extending this HomePage class, which is in turn an extenstion of another class University.Framework.UI.Page, which extends the System.Web.UI.Page class.

Am I misusing the I

Use a .lib file of a c++ code in ASP.NET


Please can some one help me out in knowing on how to use a c++ .lib file in an ASP.NET webpage.

Code Name WinFS: Revolutionary File Storage System Lets Users Search and Manage Files Based on Conte


One of the monumental problems organizations face today is aggregating information that's stored in disparate formats. Knowledge workers have long wanted to be able to search for content independent of format. The next version of the Windows operating system, code-named "Longhorn," boasts a new storage subsystem that makes that task easier. That subsystem, code-named "WinFS," allows the user to perform searches based on the metadata of the stored item, regardless of what type of file it is or which application created it. This article covers the basic architecture of WinFS and explains how to use the WinFS managed API.

Richard Grimes

MSDN Magazine January 2004

How to set WebService NameSpace in web.config file?


I am trying to put the namespace value as a key in web.config file, so that when I deploy this on production, I just have to change the namespace key in the config file only, not on all of my webservice cs files. But When I try to browse this webservice after changing this code I get compilation error.


    <add key="NameSpace" value="http://csi-dev-deep/"/>

MyWebService.cs (this code works)

[WebService(Namespace = "http://csi-dev-deep/")]

MyWebService.cs code changed to the following gives compilation error.
[WebService(Namespace = ConfigurationManager.AppSettings["NameSpace"].ToString())]

Compiler Error Message: CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression of an attribute parameter type

Your help is highly appreciated.

Thank you.

Edit MSI file dynamically using c# code. : very urgent


Hi All,

I had created one application and this is multi client application means code is same but setup is different for each client with diff. client Code in app config file, diff product code, upgrade code, setup name, display name.

So i am looking for a way to edit my MSI file dynamically and made changes into that for each client using code or any other way dynamically.

Do any one has idea how to do this Dynamically/Anyother.

Thanks in advance.


Writing the windows forms data to an HTML file

I have a windows forms application ready now i need to transfer data from the windows forms to the web and to do this i need to write an HTML file that contains the form data, i mean the data contained in the form should be written to an HTML file to be submitted and this HTML file should be generated on the local PC. I have the code for the HTML file but how can i write this HTML file with the data values contained in my windows forms. Please give your suggestions. Best Regards, Syed

Code write file asp.net 2.0 is working in firefox but IE not working.

If Not IsDBNull(ext) Then                                        ext = LCase(ext)                                    End If                                    Select Case ext                                        'Case ".htm", ".html"                                        '    type = "text/HTML"                   

How to change this code to allow more file uploads

I have a page currently setup to upload 1 image at a time, it uploaded the image, then creates a thumbnail for that image in the same directory. Client needs / wants to be able to upload a few more images at the same time. So i would like to see if i can use the existing code that works, but setup to upload a few more images and process them all to create the thumbnails. I currently have a page that allows them to upload 5 images at a time and that works fine, but its just simple uploading the images, nothing else is happening at that moment. Here is the code i am working with: protected void UploadBtn_Click(Object sender, EventArgs e) { String pth = Server.MapPath("~/gallery/homebirth/images/"); String UploadedFile = MyFile.PostedFile.FileName; int ExtractPos = UploadedFile.LastIndexOf("/") + 1; //to retrieve only Filename from the complete path String UploadedFileName = UploadedFile.Substring(ExtractPos, UploadedFile.Length - ExtractPos); // Display information about posted file. Div is invisible by default FileName.InnerHtml = UploadedFileName; MyContentType.InnerHtml = MyFile.PostedFile.ContentType; ContentLength.InnerHtml = MyFile.PostedFile.ContentLength.ToString(); //div is made visible FileDetails.Visible = true; // Save up

Problem when using Activator.CreateObject and reading App.Config file

Hello, this is the scenario. I have an application that load at runtime severals dll. these dll are actually "adapters" that wraps calls to web services, database and so on. The app.config of the "main" application stores in config sections all information necessary to each adapter (i.e.Web ServiceURL..) and I have created inside each adapter a class to ready those values the loading at run time the DLL has been implemented by storing all necessary types into a dictionary of generics and when I need to instanciate it I call the Activate.CreateObject and I pass the specific type (I means the name of the Adapter class) The problem is that the adapter class itself is not able to get the config value because ConfigSection has not been initialized. If I write: IInterfaceAdap adapt = new myAdapter() -> I read the config data IInterfaceAdap adapt = (IInterfaceAdap)Activator.CreateObject (type) -> now way to read the data stored in the App.Config. I think that I undertood the problem but I'm not able to find a workaround to read data store in the app.config!! I need help please!!  

Sharing a file handler between managed and unmanaged code?

This is related to Interops, and sharing a file handler between a WPF UI and a native C++ DLL. I'm working on an application using MVVM as a guide. I want to use WPF for the UI, however it is a complex scientific application, which requires performance, and I am using C++ along with some GPU based code for all the modeling/processing. This is a Windows based app, no real network comm involved. I come across a challenge in terms of storing data. The data is multi-dimensional, and can be projected in many ways, while each projection can be processed/filtered in many ways too. I end up with a tree of data, with the raw data at the root and many branches. XML seems like an ideal way to store the information about this dataset, but as far as the raw data, it is not so convenient. I read about base64 encoding and the various binary-XML techniques, but see a major issue: the size of the converted data (150% of the raw) which in my case is huge (raw data is easily 200MBs+, and the multitude of projections can make it several 100's of MBs easily). There is the option of saving several files, but then it may become a nightmare for a user to 'transfer' files properly, so a one-file system seems best. I basically need to have the XML-like structure accessible to the UI, while the raw data needs to be accessed by the unmanaged code. So I was thinking I could concat

"Mixed mode assembly is built against version 'v2.0.50727'.... " issue and use custom config file

Hi, My Winform applilcation has used Microsoft.SqlServer.Management.Common namespace(assembly :Microsoft.Sqlserver.smo.dll/Microsoft.Sqlserver.ConnectionInfo.dll) and developed in .NET 4.0. Problem:Application is throw an exception when it tries to use above assembly reference methods. Full error text is shown below, "Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information. " Error is resolved when we include "app.config" file with below code, <?xml version="1.0"?> <configuration> <startup useLegacyV2RuntimeActivationPolicy="true"> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> </startup> </configuration> But, I need to keep configuration file as "renamed.config" and not to include app.config file as of the project requirement.I have set configuration file as "renamed.config" file using below code, //AppDomain.CurrentDomain.SetData("APP_CONFIG_FILE", "d:\\reanmed.config" ); I have also included <Startup> element in this "renamed.config" configuration file and removed the app.config file.But it raise me below error, it always expect app.config file with <Startup> element to resolve this iss

Setting maxItemsInObjectGraph in a WCF REST config file???

Hi All, I am trying to create a new WCF Rest service. I used the online VS2010 WCF REST 4.0 template as a base. I have a service up and running and have been testing it using IE/Firefox (currently it is a read only API, so I have no need to post anything back to the service). I have an issue when the number of items being returned is too large, IE give me a "Internet Explorer cannot display the webpage" I turned on tracing and was able to confirm the issue is with the maxItemsInObjectGraph property (defaults to 65536) <Message>Maximum number of items that can be serialized or deserialized in an object graph is '65536'. Change the object graph or increase the MaxItemsInObjectGraph quota. </Message> Using the defualt WCF Web.config file I have no clue how to set this value as it doesnt seem like a standardEndpoint can have this value set, or have a custom binding or behaviour assigned to them (at least I don't know how to set them). Here is the default web.config file the template created. Does anyone know how i can update/increase the maxItemsInObjectGraph property?      <system.serviceModel>    <diagnostics>      <endToEndTracing propagateActivity="true" activityTracing="true"   &nb
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend