How to Run .asp page on vs2010 project

15,585

http://forums.iis.net/t/1150873.aspx

Typically you don't need special configuration to run Classic ASP in IIS 7. Since you have installed Classic ASP feature for IIS 7, just put your pages in inetpub folder should be OK. The error could happen when IIS configuration has been modified or web.config configuration issue.

Besides, we have been seen similar issue when you are testing Classic ASP from File System based website in Visual Studio/Visual Web Developer. This is because Visual Studio/Visual Web Developer uses the built-in ASP.NET Web Development Server which only supports ASP.NET if you choose File System based website. You can publish it to IIS server or chooses HTTP based website in Visual Studio if this is the case.

Bellow steps help to solve the problem

1)Locally install IIS on your machine.
2)from start menu run vs as admin 
3)now open the project
4)From project file set the virtual path.if your local pc os is windows7 need to define the iis port default port is 8080.
5)built the solution .
6)Run the project.
Hope it’s work perfectly

enter image description here

Share:
15,585
shamim
Author by

shamim

Working on Microsoft .NET Technology with over 8 years of industry experience. Responsible for developing and managing several applications build on .NET technology. In my day to day, work needs to maintain a set of well-defined engineering practices developed by me and as well as other developer communities, having knowledge in domain-driven design, design architectural framework, user experience, usability engineering and project management.

Updated on June 04, 2022

Comments

  • shamim
    shamim almost 2 years

    My local pc os is windows7 .Work on vs2010 C# .In my project I have .aspx and .asp files.My project start up page is .asp.After run the project I get the error .

    The type of page you have requested is not served because it has been explicitly forbidden. The extension '.asp' may be incorrect. Please review the URL below and make sure that it is spelled correctly.

    enter image description here

    Picture describe in detail

    I need help ,to run this project.What makes this project runnable?If have any query plz ask?Thanks in advance

    bellow is my asp page syntax:
    
    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <% 
    If Request("Action")="2" Then
        Response.Cookies("AdminUserID") = ""
        Response.Cookies("Username") = ""
        Session.Abandon()
    End If
     %>
    <!--#include file="Functions.asp" -->
    <%
    MM_valUsername=CStr(Request("User"))
    If MM_valUsername <> "" Then
      set MM_rsUser = Server.CreateObject("ADODB.Recordset")
      MM_rsUser.ActiveConnection = MM_LocalDB_STRING
      MM_rsUser.Source = "SELECT RepName, RepPassword, RepID"
      MM_rsUser.Source = MM_rsUser.Source & " FROM dbo.SalesReps WHERE RepName='" & Replace(MM_valUsername,"'","''") &"' AND RepPassword='" & Replace(Request("Password"),"'","''") & "'"
      MM_rsUser.CursorType = 0
      MM_rsUser.CursorLocation = 2
      MM_rsUser.LockType = 3
      MM_rsUser.Open
      If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then 
        ' username and password match - this is a valid user
        Session("Username") = MM_valUsername
        Session("AdminUserID") = MM_rsUser("RepID")
        Response.Cookies("Username") = MM_valUsername
        Response.Cookies("Username").Path = "/"
        Response.Cookies("AdminUserID") = MM_rsUser("RepID")
        Response.Cookies("AdminUserID").Path = "/"
        Response.Cookies("Username").Expires = DateAdd("d",1,Date)
        Response.Cookies("AdminUserID").Expires = DateAdd("d",1,Date)
        Response.Redirect("default.asp")
      Else
        Response.Write("User Name or Password is wrong")
      End If
      MM_rsUser.Close
    End If
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>1800wheelchair.com - Login</title>
    <link href="Styles.css" rel="stylesheet" type="text/css">
    </head>
    
    <body onLoad="document.Login.User.focus()">
    <!--#include file="Header.asp"-->
    <form ACTION="login.asp" METHOD="get" name="Login">
    <table width="100%" border="0" cellpadding="0" cellspacing="0" height="300">
    <tr height="300">
    <td align="center">
    <table width="275" height="150" border="2" cellpadding="0" cellspacing="0" bgcolor="#EFEFEF" rules="groups">
        <tr>
          <td colspan="2" align="center" class="labelA"><b>User Login</b></td>
        </tr>
        <tr>
        <td class="text">&nbsp;&nbsp;User Name: </td>
        <td><input tabindex="0" name="User" type="text" value="<%= Request("User") %>" size="20"></td>
      </tr>
      <tr>
        <td class="text">&nbsp;&nbsp;Password: </td>
        <td><input name="Password" type="password" value="" size="20"></td>
      </tr>
      <tr>
        <td colspan="2" align="center"><input type="submit" value="Log In"></td>
      </tr>
    </table>
    </td></tr>
    </table>
    </form>
    </body>
    </html>
    

    if i change the extension of asp page as aspx show the bellow error

    enter image description here