2

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

Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
shamim
  • 6,640
  • 20
  • 85
  • 151

3 Answers3

2

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

shamim
  • 6,640
  • 20
  • 85
  • 151
0

This sounds like the error you get on an IIS6 box when you've not enables the ISAPI extension for .asp files. Open the IIS Admin tool and go to your local computer then check out the "Web Service Extensions" and make sure "Active Server Pages" are allowed.

ananth_adroit
  • 245
  • 1
  • 4
  • 18
  • ananth_adroit thanks for reply.My local os is windows 7 and i use iis 7.I don't get your above configuration – shamim Nov 01 '11 at 06:38
  • In that case, here's another link for you: http://technet.microsoft.com/en-us/library/cc753918(WS.10).aspx – ddrace Nov 01 '11 at 06:50
0

As @anath points out, it could be an IIS issue, but since you said you were working in VS2010, I'm thinking the issue is with VS2010's built-in server. Here's a discussion that might help.

ddrace
  • 717
  • 3
  • 12