C# - Serving Htm Or Xml Files From ApplicationHost?

Feb 25, 2011

I am hosting the ASP.Net runtime in my exe but I find that if I try to access htm or xml files from the browser, it gives a 404.

I can access aspx, asmx and other asp.net related files just fine.

Is there any configuration that I need to do to server other file extensions and if so, what?

View 1 Replies


Similar Messages:

Serving ISO-8859-1 And UTF-8 Files From C#?

Mar 7, 2011

We have a large site with thousands of static html files. Some of them are ISO-8859-1, others are UTF-8 (with and without byte order marks).

The web.config file looks like this:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<globalization requestEncoding="utf-8" responseEncoding="utf-8" fileEncoding="utf-8" />
</system.web>
</configuration>

If I change the fileEncoding to "ISO-8859-1" it works for both ISO-8859-1 and UTF-8 if there is a byte order mark. We are trying to avoid manually checking and adding byte order marks to files that do not have them. Is there any way to accomplish this?

The files have the charset meta tag. Can we make the server read that to determine the file encoding?

EDIT

If I remove the wildcard application mapping to aspnet_isapi.dll the files are served correctly. Is there any way to have the wildcard match everything except for .html?

View 1 Replies

C# - IIS URL Rewriting - Keep Relative Paths When Serving Multiple Files?

May 25, 2010

My WebApp is part CMS, and when I serve up an HTML page to the user it typically contains relative paths in a.href and img.src attributes. I currently have them accessed by urls like: ~/get-data.aspx/instance/user/page.html -- where instance indicates the particular instance for the report and "user/page.html" is a path created by an external application that generates the content. This works pretty reliably with code in the application's BeginRequest method that translates the text after ".aspx" into a query string, then uses Context.RewritePath(). So far so good, but I've just tripped over something that took me by surprise: it appears that if any of the query string ("instance/user/page.html") happens to contain a plus sign ("+") the BeginRequest method is never called, and a 404 is immediately returned to the user.

So my question is two-fold:

Am I correct in my belief that a "+" would cause the 404, and if so are there other things that could cause similar problems? Is there a way around that problem (perhaps a different method than BeginRequest)? Is there a better way to preserve relative URL paths for generated content than what I'm using? I'd rather not require site admins to install a 3rd party rewrite tool if I can help it.

View 1 Replies

Errors Running .NET 1.1 On IIS7 (applicationHost.config)?

Jan 11, 2011

I am trying to port an existing ASP.Net 1.1 website to another web server that currently runs IIS7 and a number of websites that target either .Net 2.0, 3.5 or 4.0. All other sites continue to work perfectly. Unfortunately, I can only browse static files on the newly imported site. If I try to access any of the Features in IIS7 for the new sit

View 1 Replies

C# - XML Parseing Error When Serving A PDF

Apr 13, 2010

I'm trying to serve a pdf file from a database in ASP.NET using an Http Handler, but every time I go to the page I get an error

XML Parsing Error: no element found
Location: https://ucc489/rc/NoteFileHandler.ashx?noteId=1,msdsId=3
Line Number 1, Column 1:
public class NoteFileHandler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
[code]...

View 1 Replies

Scaling And Serving Images With .NET 3.5?

Oct 27, 2010

I am working on a web application where images has to be scaled dynamically and served to the client as fast as possible (with low overhead). I need to create something that scales and compresses high-quality PNGs to medium quality JPEGs.Now, there are multiple ways of doing this and I am slightly confused which method provides the best solution for the application to be as fast as possible - and I was hoping you guys could guide me in the right direction.This application will run on the .NET 3.5-platform and I am looking for fresh ways of doing this. Googling has given me some clues but most of the articles I found were VERY old (2000-2005 or so).The client app is written in ASP.NET MVC, while the backend app is written in Web Forms. The images are located in a directory in the Web Forms application, but I guess that dosen't say the image handler must be written in Web forms.

View 3 Replies

Serving Videos From Amazon S3?

Dec 17, 2010

If I host video or any other media content on Amazon S3, how can I use ASP.net Membership to enforce access rights?

View 1 Replies

Configuration :: Ock Down A Web Server That Is Only Serving MVC Content?

Apr 17, 2010

I would like to lock down a web server that is only serving MVC content. What is the best way minimize my server's attack surface?

View 2 Replies

Serving Up Multiple Content Items?

Feb 4, 2010

got a Asset Management tool which stores (in a folder("node")) an index.htm and a bunch of other asset files such as .js, .css, flv, etcHere's the problem...if I access the index.htm I get ti via it's nodeID http://site/NODEGUID/index.htm , and all compound files try and download via that GUID as well so essientially I just get index.htm content served into each request file, thus giving me an epic fail :)Is there some way in asp.net to intercept that request so I can do a lookup on the DAM and get the proper file reference and send that down instead?

View 3 Replies

Web Forms :: IIS Stopped Serving Webrequests After Certain Requests?

Feb 17, 2011

I am creating a small testharness which will create load on the website with multiple threads. All I doing is

[Code]....

But this keeps timing out after few request. I have looked into the IIS worker process requests and I can see the requests being in there in the state of sendresponce. If I request the same url from my browser the reponce is there. Am I doing something wrong here?

View 4 Replies

C# - IIS Not Serving Website Pages On Remote Client

Dec 28, 2010

I am new to IIS and asp and i am having a problem. I am creating a asp.net website in physical folder wwwrootSharePage and virtual directory SharePage When i visit the site on local host or using my ip address or through dyndns proxy on my own computer , the page is served fine, But when any one else from any other computer access my website it takes a long time in loading and finally his browser throws an error (may be page not found error,not sure, see for yourself). I have even changed Authentication mode to none and tried with firewalls closed , still page is not served.

You can have a look here

[URL]

(hosted on my home computer so can be unavailable at times when i have switched off my computer)

or try with my ip address

updated http://117.205.103.192/SharePage/ (can change ,i have a dynamic ip address)

Info:
IIS version 7.5
OS : Windows 7
.Net 4 (even in IIS)

View 3 Replies

Change HTTP Status 503 To 200 When Serving App_offline.htm For Specific URL?

Feb 22, 2011

The app_offline.htm file that ASP.NET serves returns the http status 503. This is the correct behavior for most situations. However, in the scenario where a specific URL is requested (e.g. [URL]), I'd like to change the returned http status to 200, while still returning http status 503 in all other situations. Is this possible?

The reason why I want to do this is whenever we do scheduled maintenance on our website, we use the app_offline.htm file, but we don't want our uptime monitoring service [URL] to report downtime during our scheduled maintenance.

I assume this would have to be at the IIS level because the app_offline.htm gets served very early on in the request processing cycle.

View 6 Replies

Iis7 - Serving Static Content From A Subdomain Using URL Rewrite

Feb 24, 2011

I have a domain which is receiving quite a few hits per day and have been asked if I can serve the static content from a subdomain. As the site is quite extensive and already written, I was wondering if there is any way I can use URL rewriting to change:

www.example.com/image.gif
to
static.example.com/image.gif

I have a solution which works using 301 redirects but from what I understand, this is counter productive as 2 requests will have to be made per image. I don't really want to go through all the aspx pages and css to hard code the new url as it will cause problems further down the line - some parts of the site are still being developed and static content could change at any time. I tried using rewrite (as opposed to redirect) to change the url but it came out something like:

http://www.example.com/http://static.example.com/image.gif

How would you achieve this? I have full access to dns and the server (win 2008r2 / IIS 7.5) so can make any changes if url rewriting is not the answer.

View 1 Replies

.net - Serving An Image Stored In A Database On An Aspx Page?

Aug 23, 2010

I'm pulling back an image that is stored in a column in a SQL server database.I need to serve this up on an aspx page.

View 4 Replies

Serving An Image With A Generic Handler Within A List View. Is It Possible

Feb 27, 2011

Currently in my webpage i load images to the ListView object as follows...

<ContentTemplate>
<asp:ListView ID="ListView1" runat="server">
<layouttemplate>

[code]...

View 2 Replies

Content Type When Serving A File In A Generic Handler?

Dec 10, 2010

I'm busy writing a handler to serve various documents for download or presentation in web forms pages. The documents range from various image formats, to PDF, to MS Office documents, to generic binaries. My basic draft of the download process is as below:

[code]....

However, I have some misgivings about lumping all documents together as application/octet-stream, and I would prefer, if feasible, to use a more specific content type per document type. I have a DB table for document types where I could store this. Am I going in the right direction, and if so, where can I find a suitable starting list of content types for document types?

View 1 Replies

Architecture :: Serving A Large Amount Of Users On A Web Server?

Oct 5, 2010

I have a project that will be assigned to me soon whereby I need to develop a survey which needs to support 40,000 users approximately. Now we are thinking of doing a staged approach so not all users are on the server at any one point of time. Probably splitting it so we can serve at least a few thousand of users...

I dont have much experience of how I can ensure to serve those levels of users on a server and how to manage this so I am after some advice?

From my understanding I need to do some stress testing on a server and obviously I need some figures i.e. average size of request, average size of response and content of response.

- Do I have to build the database and add records in to see what size is a typical survey row?

- Do I have to build the survey in .NET i.e. by adding controls etc and seeing what size is the page?

- The survey shouldnt be too instensive processing wise, it will be adding information into a backend sql database...

View 4 Replies

JQuery Dialog Serving Multiple Button's Click Event Handler?

Oct 7, 2010

I have a scenario where...

1.) Have created a div with a dropdown list and ok, cancel button

2.) On document ready - registering div created on step 1 into a jQuery dialog

3.) on a javascript button click - I am opening this dialog box.

4.) Now, the problem is - the jQuery dialogbox which I have created, needs to be used by other button clicks as well on same page. Now, my div's (which is a dialog at runtime using jQuery) ok button click is already engaged with a javascript function (button1 click) and I can not associate other button's click events with it - thus stuck up here and have no clues or hit to resolve this.

View 2 Replies

Determine Size Of Page's Viewstate Before Serving Page?

Oct 28, 2010

What ASP.NET page lifecycle event can I write code in to determine the size of the viewstate that being sent out? Also, is it possible to determine the size without parsing through the rendered HTML (like a property on the page object) or is parsing the only way?

What I'd like to do is log the sizes, specifically if they cross a certain threshold.

View 3 Replies

C# - Serving An Exe To Firefox From An Aspx. Firefox Downloads It As "Content". Incorrect Filename And No Extension?

Mar 28, 2011

I'm trying to server an exe to Firefox from an aspx page. The aspx page handles the headers and the page is launched by our Flex GUI. Flex correctly launches the link for all browsers (including Firefox) so I'm certain that's not the issue.

The problem I'm having is when I try to download the file from within Firefox, FF downloads the file fine but it names it "Content". It has no extension and the file name is incorrect. All the other browsers download it with the file name I specified in the aspx page and they all have the .exe extension. I should note that if I rename the "Content" file to "Content.exe" it runs correctly.Below is the code I'm using in my aspx page -

protected void Page_Load(object sender, EventArgs e) {
string fileName = Request.QueryString["file"];
System.IO.FileInfo fileInfo = new System.IO.FileInfo(Server.MapPath(fileName));

[code]...

View 2 Replies

Can Server .html Files Using Razor As If They Were .cshtml Files Without Changing The Extension Of All My Pages

Feb 24, 2011

I manage a large asp.net site which has previously been converted from static html site to asp.net. For several reasons (mainly SEO) we decided not to rename all the files to .aspx back when we originally converted the site. This was very easy to do by simply adding the buildProvider and httpHandler to the web.config.

<buildProviders>
<add extension=".html" type="System.Web.Compilation.PageBuildProvider"/>
</buildProviders>
<httpHandlers>
<add path="*.html" verb="*" type="System.Web.UI.PageHandlerFactory"/>
</httpHandlers>

Now I am upgrading the site to use Asp.net WebPages with Razor cshtml files. I can rename all the files if necessary, and use url rewriting to make the urls stay the same, however it would be much easier if I could just configure the web.config to tell it to parse .html files as if they were .cshtml. I have searched around quite a bit, and could not find anything equivalent to the PageHandlerFactory for razor pages. It appears as though it is just an internal mechanism in the .net 4.0 ISAPI handler.

The site is currently running on Windows 2003 server and IIS 6. We will be upgrading to 2008/IIS 7.5 in the near future, but I'd prefer not to wait for that. Is there any way to get the .html files to be parsed by razor as if they were .cshtml files?

View 2 Replies

Visual Studio :: Want To Do A Reverse 'search In All Files', So It Returns Files That Don't Contain "keyword?

May 6, 2010

I basically want to do a reverse 'search in all files', so it returns files that don't contain "keyword".Does anyone know how to do this, or the regex used, etc?

View 1 Replies

Configuration :: ResourceManager And Resx Files - Files To Display Items In Multiple Languages

Oct 13, 2010

I have an application that uses resource files to display items in multiple languages. My app uses quote a lot of javascript and the alerts need to display in the local language. To do this, I have created an http handler which will read the keys and values of the culture-specific resource file and write them to a JSON array which is then embedded in the page in a script tag, the messages can then be accesses using, for exmaple:

Message.Error (en-GB = "Error", fr-FR = "Erreur")

The messages http handler works great in development, however when I run the application on a test server, I get the error: Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "Resources.Alerts.resources" was correctly embedded or linked into assembly "App_GlobalResources.b0n9j90e" at compile time, or that all the satellite assemblies required are loadable and fully signed. The code that I use to acccess the resource file is:

ResourceManager manager = Resources.Alerts.ResourceManager;
ResourceSet resourceSet= Resources.Alerts.ResourceManager.GetResourceSet(Thread.CurrentThread.CurrentCulture, true, true);

Where Resources.Alerts is the type that contains my multi-lingual definitions. The build action for the Alerts.resx file is set to "Embedded Resource". Any ideas why this works locally but not on my test server, am I missing something?

View 1 Replies

Security :: Non-asp Files / Moved The Pages And Files To Other Folders And Set The Web.config File On This Folder?

Jul 1, 2010

I was following the tutorials from this two sites:

http://www.15seconds.com/issue/070104.htm

http://aspnet.4guysfromrolla.com/articles/020404-1.aspx

Following the first site, it had worked but when I´ve moved the pages and files to other folders and set the web.config file on this folder, now it won´t work at all!!!

The file is an *.swf object. I did put the asapi.dll to map the extension on the website root, I´ve put the

[Code]....

on the web.config new folder and on the web.config website´s root.

It won´t work!!! I can access the file directly!!! on the web.config of the folder that contains the file, there is a <deny users="*" /> line.

View 4 Replies

Installation :: After Installing Server 2008 The Program Files Disapper With The SQL .MDF Files?

Nov 12, 2010

I am not sure this is the forums but I dont know where to write this and this is an EMERGENCY ::I had windows 2003 server. on C: and I have installed windows 2008 server.I had SQL server installed and all of the database files stored inside c:program filessql server....PROBLEM is that after I installed 2008 server I can see 2 folders of program files one for x86 and the other for 64 bits.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved