Category Archives: asp-classic

Rename product page with web.config

Since I have this URL:

http://namedomain.com/product.asp?id=01&color=05&name=xxxx

What is the better approach to rewrite this URL like this:

http://namedomain.com/xxxx

With IIS I was able to generate this URL

http://namedomain.com/01/05/xxxx

This is the web.config code:

<rule name="RedirecionaPagProduto" stopProcessing="true">
    <match url="^exibe_produtos\.asp$" />
    <conditions>
        <add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
        <add input="{QUERY_STRING}" pattern="^produto=([^=&amp;]+)&amp;cor=([^=&amp;]+)&amp;url=([^=&amp;]+)$" />
    </conditions>
    <action type="Redirect" url="{C:1}/{C:2}/{C:3}" appendQueryString="false" />
</rule>
<rule name="RenamePagProduto" stopProcessing="true">
    <match url="^([^/]+)/([^/]+)/([^/]+)/?$" />
    <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
    </conditions>
    <action type="Rewrite" url="exibe_produtos.asp?produto={R:1}&amp;cor={R:2}&amp;url={R:2}" />
</rule>

Anyone can help?

IIS – How to display/parse PHP code received from another server

Good evening to everyone. I am an IIS newbie, so I apologize if this is a trivial question. I cannot find any solution surfing on the web, but probably I'm using wrong keywords for searching. I'm trying to replicate the behaviour of an existing c/s system (not developed by me) in which my server-side application is made of two servers: one IIS running old ASP classic and one Linux Apache Postgres PHP. The Windows environment is just the way used by the previous developer to expose web contents to the whole world. Those contents are provided in many ways, but mainly as PHP code coming from the linux/unix machine. On my workstation I'm replicating this as windows IIS + Ubuntu VM. The Ubuntu VM appears fully functional. The Windows machine has IIS installed and PHP (5.3) (the windows version - the microsoft installer). Using firebug I can see that I receive the PHP content, but this content is not displayed as it should, instead it generates console errors. What am I doing wrong? Which step of my IIS configuration am I missing? Or is it something different? Thanks in advance for any replay Best GLB

IIS – How to display/parse PHP code received from another server [on hold]

Good evening to everyone. I am an IIS newbie, so I apologize if this is a trivial question. I cannot find any solution surfing on the web, but probably I'm using wrong keywords for searching. I'm trying to replicate the behaviour of an existing c/s system (not developed by me) in which my server-side application is made of two servers: one IIS running old ASP classic and one Linux Apache Postgres PHP. The Windows environment is just the way used by the previous developer to expose web contents to the whole world. Those contents are provided in many ways, but mainly as PHP code coming from the linux/unix machine. On my workstation I'm replicating this as windows IIS + Ubuntu VM. The Ubuntu VM appears fully functional. The Windows machine has IIS installed and PHP (5.3) (the windows version - the microsoft installer). Using firebug I can see that I receive the PHP content, but this content is not displayed as it should, instead it generates console errors. What am I doing wrong? Which step of my IIS configuration am I missing? Or is it something different? Thanks in advance for any replay Best GLB

Issue shortening dynamic URLs

I've searched and tried several possible solutions.

I begin with:
http:// example.com/ 729/start-page.asp?cid=4004
http:// example.com/ 729/start-page.asp?cid=7916

and trying for:
http:// example.com/ johns-start-page
http:// example.com/ judys-start-page

or if possible:
http:// johns-start-page.example.com/
http:// judys-start-page.example.com/

so far I've got:

RewriteEngine on
RewriteCond %{QUERY_STRING} ^cID=4004$  
RewriteRule ^729\.asp$ /johns-start-page [NC,R=301,L]

RewriteCond %{QUERY_STRING} ^cID=7916$  
RewriteRule ^729\.asp$ /judys-start-page [NC,R=301,L]

Apache authentication and ASP

Is it possible to logon a user with Apache authentication and use the same cookies to logon user to an ASP site?

Here is how the server configuration looks:

Browser > Apache > IIS (running inside a private network)

Currently when we hit the site, it shows the apache logon prompt. After user gets authenticated successfully it lands to login page of an ASP application running on IIS on a separate machine. Here user have to login again to get into the ASP application.

What I want to achieve is to have the user log in once through apache authentication, store the session in a cookie and use the same session to log on to ASP application.

Thanks for your help.

Convert htaccess in to webconfig file

I have to convert that my htaccess file in to web.webconfig file. this is my htaccess file. please help me to write complete web.config file for this. I am not good in windows server scripts

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /

 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-l

 RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
</IfModule>

I tried with this, but it's not working

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Rule 1" stopProcessing="true">
                    <match url="^(.*)$" ignoreCase="false" />
                    <conditions logicalGrouping="MatchAll">
                        <add input="{REQUEST_FILENAME}" pattern="\.(php|htm|html)$" ignoreCase="false" />
                    </conditions>
                    <action type="Rewrite" url="index.php?q={R:1}" appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>
</configuration>

Thanks!

Execute PHP Code on ASP Page

Does anyone know if there is a file handler (or some other directive) that can be added to an .htaccess file that will force PHP code to execute within an ASP page? It's working currently on client's site but it will not on new server at GoDaddy under Plesk.

This is what's currently in the .htaccess file on the site that works, but it is not working on the new server.

<FilesMatch "\.asp$">
    ForceType application/x-httpd-php
</FilesMatch>

Thanks.

web.config 301s for all files but one

I'm trying to set up 301s for a site which will bounce all old pages to the homepage (it was a large site that is now a single page).

The server's Windows based, however, so no htaccess fun for me.

Could anybody assist with producing a web.config file that redirects everything to the homepage via 301s?

Many thanks! Graham