Source Code shows for ASP.NET web page - asp.net

I have a simple .aspx file that I want to run in my browser. I have installed IIS, along with all ASP.NET features, on my local machine. I am using USBWEBSERVER as a server to display my web pages.
When I put in the path of the file of my of web page (.aspx file), just like I do with all my PHP pages, I get the source code (instead of the GUI).
How can I set this up so .aspx pages will work on my machine?

I think you have to get a web server that supports ASP.NET. Right now, there's IIS Express, which is free and can host a multitude of technologies:
http://www.microsoft.com/en-us/download/details.aspx?id=1038

Related

Linking a .asp page from .aspx page

I am wondering whether could I link a .asp page from a .aspx page. I am using Visual Studio 2012 and I have few .asp pages created before. I want to transfer my new .aspx page to some of these .asp pages. But when I do that it is not showing up in my web browser. It moves to that page but nothing is shown up. I am pretty new to ASP.NET and please guide me.
If should not happen if you are using IIS express to debug (start directly within Visual Studio), but if you are using IIS to host and run the site, it might be because you did not add the asp support to IIS, you could double check it by going to IIS manager -> Handler Mappings, looking for aspClassic, if it does not exist, it means you need to go into Program And Features in control panel to enable that.

ASP.NET IIS 6 deployment error - Cannot view XML input using XSL style sheet

I am working on an ASP.NET website. I am trying to deploy the website on Windows 2003 server, IIS 6. The website works fine when I run using Visual studio 2010. but I am not able to deploy on IIS 6 and access the website login page.
I published the website and created a new Virtual directory in IIS 6 pointing to the precompiled website folder under c:\Inetpub\wwwroot\App-name folder.
I get the below error message when i try to access the website login page.
The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.
A name was started with an invalid character. Error processing resource
'http://myappservr.com/app-name/Login.aspx'. Line 1, Po...
<%# page language="C#" autoeventwireup="true" inherits="Login, App_Web_rmgltjnq" %>
-^
In IIS, under ASP.NET tab, I selected the ASP.NET version as v2.0. In IIS, under Web service extensions folder ASP.NET 2.0 is allowed.
Why the does the browser show the message is The XML page cannot be displayed Cannot view XML input using XSL style sheet when I access the aspx page from the IIS?
Please let me know how to fix this issue when access the website from IIS 6.0
Thanks
Ashok
The error you are receiving means that IIS is not processing the asp.net pages at all. It is simply displaying the HTML directly to the browser. The error you are getting is the same one you would receive if you opened the .aspx page directly in the browser from the file system.
Steps to make sure
the .net framework is actually installed on the server.
if it is, make sure it is enabled to be served. MS disabled many application development features by default to avoid servers becoming a potential viral attack vector.
Go to the Server Manager on the server
Select the Web Server (IIS) Role to show the details under the Role Services list ensure that the Web Server | Application Development | ASP.Net and .Net Extensibility nodes are Installed.
If not, select the Add Role Services options to add those and any other Application Development eatures you need.
If correct, you may need to run aspnet_regiis to update the mappings. Usually the -i or -ir options are most commonly selected.

Trouble setting up IIS for ASP

Windows 7 Ultimate
IIS7
At first I enabled all settings in IIS, the default page of IIS could be viewed but when I tried to view pages in C:\inetpub\wwwroot\MyWeb, I used to get a 404 error.
Then I tried:
ASP
ISAPI extensions
Request filtering
It didn't show me the default IIS page even. Then I tried:
ASP
ASP.NET
ISAPI Extensions
Default document
Static content
Request filtering
It showed me the default page but when I tried to view files in the directory, Chrome said that the link appears to be broken. At present my settings are:
IIS management console
.net extensibility
asp
asp.net
cgi
isapi extensions
isapi filters
server-side includes
default document
static content
request filtering
Still, I am getting the "link broken" message.
Oh, and I am using Dreamweaver CS5 and when I preview the ASP page from Dreamweaver it asks me if I would like to specify a testing server. I choose No as I am new to this and not aware of how to specify a server. Is that the problem?
This is the official site for your problem:
http://www.iis.net/learn/application-frameworks/running-classic-asp-applications-on-iis-7-and-iis-8
The first entry is probably what you need.
I recently set up ASP on IIS8 by simply installing the server features you listed first (ASP and ISAPI Extensions). Maybe you have another problem, like a wrongly setup website in IIS. You could enter a simple default.asp or maybe you should try a iisreset and check that some static file is available where you expect the asp files to work.

Hiding Sourcecode on IIS Server (ASP.net)

I have a question about hiding or encoding the source code on a server which runs IIS.
At the moment the source code is available and visible for all users who are logged into the server where the IIS Server is running.
Is there a way to hide the Code (encode) with Visual Studio or any other software?
I think the aspx (or *.html) web site code can not be encoded but (for example) the *.vb code sites should be able to encode.
You can simply Publish the website
Build Menu => Publish Web Site
So the code behind files (*.aspx.cs) will get converted to dll(Bin/*.dll) file.
Refer this: Walkthrough: Publishing a Web Site
When you are ready to put your project live make sure that you.
Publish it.
When you publish it that you tell it to compile your code into a single library or code behind files.
If you want to protect your html as well then you should not select to make the site updateable.
These steps will protect your code but as for your web.config file you will need to look at some other articles on securing its info.
If you can, I would recommend ensuring that only the authorized people have access to the server and/or the code base running on the server. If that is the case then you should be ok.
Go to Build menu---> Click on Publish the Website.
then a folder get created on the base folder. and the encoded files are available there. That can be upload to the FTP account, then third party can't see the source code with the browser.

asp .net 4.0 app on IIS7 Error 404.17

I am having a problem setting up a website under IIS 7. I have created an application and the application pool for the application. Application pool is using .Net Framework 4.0 as my .net app is written in .Net Framework 4.0. Application pool is set to use classic Pipeline Mode. MIME Types have been automatically added to .asp & .aspx.
When I run the website windows explorer is showing me "View Downloads" and trying to download "application name localhost" when it downloads the file I notice that its the html of my default.aspx. I have checked Default Document and it contains Default.aspx.
If I remove .asp & .aspx MIME Types then I get an error: HTTP Error 404.17 - Not Found The requested content appears to be script and will not be served by the static file handler.
I have seen this problem many times. IIS is not serving aspx pages and most likely is not running for the entire server or that site.
For the entire server: Check to see if iis world wide web service is running.
For the site alone: Hit run inside IIS.
You can easily know if IIS is running properly by going to IIS and hit the browse option from inside a web site.
With the data you have put these are the things I would try in order if I were you:
Check in Server Manager/ Features if ASP.NET is installed (ServerManager/Roles/Web Server(IIS) look for ASP.NET
Check IIS Manager if everything is ok by:
Try to browse a test.html file to see if you are able to browse normal
Check Basic settings by clicking Test Settings
Check Handler Mappings to see if aspx is there.
Try to browse a sample test.aspx page with test data.
Check Application pool settings.
Reinstall Framework 4.0
Reboot machine ( a classical)
If you gave us more info and/or the ouput of my proposed tests maybe can help more. Good Luck :)
I had the 404.17 error happening on a server today. As you and cad mentioned, I checked the framework of the Application Pool that my site was using to make sure it was set to ASP.Net 4.0, and it was. What happened in my case is that my site was not using the application pool that I thought it was. My site was nested under another site, meaning my site pointed to a subfolder but another site was pointing to the root folder. Even though I had my site set to use the ASP.Net 4.0 Application Pool, the root site used a different Pool that had ASP.Net turned off, it was set to "No managed code". When I set the framework to 4.0 for the Pool the parent site was using, then my site started working.
In my case the solution was fixing the Handler mappings as explained here: http://forums.iis.net/post/1943489.aspx
IIS Manager->high-light you web site->click Handler Mappings icon on
the home pane->click Revert to Parent...
on the right Actions pane

Resources