Mapping Handler To Static Extension?

Jan 4, 2010

What are some unintended consequences associated with mapping an ASP.NET HTTP Handler to a static extension like *.css?

<add verb="*" path="handler.css" type="Web.HttpHandler.ThemeCssHandler" />

By default, *.css is registered as static content in applicationHost (under IIS7):

<staticContent lockAttributes="isDocFooterFileName">
<mimeMap fileExtension=".css" mimeType="text/css" />

Aren't static requests normally handled more efficiently by IIS alone?

The key motivation is really to have dynamic CSS served under its known extension as opposed to something like *.axd (for simplicity and compatibility with OOTB cache policies); but we'd like to make sure this doesn't degrade the service of non-dynamic CSS requests.

View 1 Replies


Similar Messages:

How To Call Static File Handler From HTTP Handler In IIS7 And 4.0

Jan 24, 2011

I create custom HTTP handler for auto generating file and I want to tell IIS7 to serve current request like normal static file because I need to use IIS and web.config file to control compression setting and any other HTTP header of current requested file.I know. there is an internal class called StaticFileHandler in ASP.net. But I cannot access it. Or you have any other way to work like this.

View 1 Replies

Mapping A Class To A Custom Page Extension?

Mar 3, 2010

What I would like to have is a mapping between a custom file extension to a class that is not System.Web.UI.Page but a class of mine that inherits from System.Web.UI.Page.

i.e.:

*.aspx -> System.Web.UI.Page
*.my -> My.Package.MyClass (inherits from System.Web.UI.Page)

I know I can map any extension to be treated like .aspx but I can't find the way to do what I have in mind.

View 3 Replies

Configuration :: Mapping Pages W/Out Extension To IIS7?

Dec 11, 2010

I'm still trying to resolve a problem with relative links on a page that uses URL routing. The relative links work find when running from Visual Studio, but fail when deployed to a shared hosting account.I'm told that the difference is that Development Server handles all requests through ASP.NET handler but IIS7 doesn't. The result is that URLs with no extension are considered folders on my test machine, and filenames on the shared hosting account. That breaks the relative links.

It was suggested that I do wildcard mapping to IIS7. But I can't make random changes to the shared server machine. I also have concerns about routing everything through IIS, graphics files, style sheets, javascript files, etc. In addition, I also tried adding a <base> tag, which fixed this issue but broke other links on the page.

So I'm left with two questions.

1. If IIS isn't processing files without an extension, then how does my routed page display as an ASP.NET page?

2. What I'd really like to do is specify in my web.config that all files with no extension be handled the way they're handled when running from Visual Studio. I don't suppose that's possible.

View 2 Replies

Mapping - How To Integrate Yahoo Static Map In ASP.Net Website

Oct 5, 2010

How to display yahoo static map in ASP.Net gridview control? The address for loading the map will be present in one of the columns of gridview and based on the address of each row the static map has to be displayed on each row.

View 1 Replies

Specify The Application Root In Web.config Handler Mapping?

Mar 14, 2011

I have an application with an HttpHandler that processes any requests for a .js file. I only want this handler to process *.js files that are requested in the root of the application.

The handler mapping looks like this:

<add name="HandleJS" path="*.js" verb="*" type="MyApp.JsHandler" resourceType="Unspecified" requireAccess="Script" preCondition="integratedMode,runtimeVersionv4.0" />

Currently, this handler processes ALL requested *.js files. Here is an example of the behavior I want.

This request would be processed by the handler: http://localhost/myapps/approot/script.js

and this one would not be processed by the handler: http://localhost/myapps/approot/dontProcessMe/script.js

I'd really like to avoid including the full absolute path in the handler path so I tried some other things first.

It doesn't look like the path property of the add element allows the use of the ~/ application root mechanism, so setting path="~/*.js" doesn't work.

I've also tried replicating the StaticFile handler that's built into IIS and doing something like this:

<add name="MyStaticFiles" path="*/*.js" verb="*" modules="StaticFileModule" />

or

<add name="MyStaticFiles" path="dontProcessMe/*.js" verb="*" modules="StaticFileModule" />

Both of which just return a blank response with an HTTP status of 200.

View 2 Replies

Configuration :: Handler Mapping Adding With Appcmd.exe Command?

Dec 7, 2010

I have added a new handler mapping (Windows Server 2008 R2 64 bit.) with command

"%SystemRoot%"system32inetsrvappcmd.exe set config /section:handlers /+[name='ASPHandler',path='*.asp',modules='IsapiModule',scriptProcessor='%windir%system32inetsrvasp.dll',verb='GET,HEAD,POST',resourceType='File',requireAccess='Script']

This line is inserted into file

C:WindowsSystem32inetsrvconfigapplicationHost.config:

<location path="" overrideMode="Allow">
<system.webServer>
<handlers accessPolicy="Read, Script">[code]....

it can be seen in Handler Mappings window. But I want to add this by script not to do any manual configurations in file.

View 1 Replies

Possible To Map A New File Extension To An Existing Handler

May 18, 2010

I have a scenario where my application is going to be publishing services that are consumed by both PC's and mobile devices, and I have a HTTPModule that I want to only perform work on only the mobile requests. So I thought the best way of doing this was to point the mobile requests to a different file extension and have the HTTPModule decide to process only if the request targets this new extension.

I don't need a custom HTTPHandler for the new extension; I want to program the services like a normal .ASMX service, just with a different extension.

First, can I do this? If so, how do I do it so that requests to my new extension are handled just like .ASMX requests?

Second, is this the right approach? Am I going about separating and managing the mobile vs. PC requests the wrong way?

View 1 Replies

HttpHandlers / Modules :: Set Handler Mapping To Redirect .php File To .aspx File On IIS7?

Mar 15, 2011

Our website used to be a php website, now everything changed to .net, but the customer still want to keep the original php Request url. I want to know How to set Handler mapping on IIS7 to redirect .php file to .aspx file ? In more details, when you click handler mappings on IIS 7.0, what kind of hanlder should you add (add managed handler or add script map or add wild card script map or add module mapping) to redirect .php file to .aspx file?

View 1 Replies

Using Extension Methods In Static Methods On Extended Classes?

Aug 16, 2010

I have an extension method as follows:

public static class PageExtensions
{
public static int GetUserId(this Page targetPage)
{
var user = Membership.GetUser(targetPage.User.Identity.Name);
return (int)user.ProviderUserKey;
}
}

Now in a page I need to use this method in a static WebMethod, so I have added another 'extension method' to PageExtensions:

public static int GetUserId()
{
return (int)Membership.GetUser(HttpContext.Current.User.Identity.Name).ProviderUserKey;
}

and I call it as follows in my WebMethod: PageExtensions.GetUserId()

View 1 Replies

C# - Is It Safe To Access .net Session Variables Through Static Properties Of A Static Object

May 10, 2010

Is it safe to access asp.net session variables through static properties of a static object?Here is what I mean:

public static class SessionHelper
{
public static int Age
{
get
{
[code]...

Is it possible that userA could access userB's session data this way?

View 2 Replies

C# - How To Lock A Private Static Field Of A Class In One Static Method

Mar 26, 2011

I have a private static field in my Controller class in an MVC web application.

I have a static method in that controller that assigns some value to that static field, I want to apply lock on that static field until some other instance method in the controller uses the value stored in the static field and then releases it.

DETAILS:

I have a controller named BaseController having a static ClientId field as follows and two methods as follows:-

public static string ClientId = "";
static void OnClientConnected(string clientId, ref Dictionary<string, object> list)
{
list.Add("a", "b");
// I want the ClientId to be locked here, so that it can not be accessed by other requests coming to the server and wait for ClientId to be released:-
BaseController.clientId = clientId;
}
public ActionResult Handler()
{
if (something)
{
// use the static ClientId here
}
// Release the ClientId here, so it can now be used by other web requests coming to the server.
return View();
}

View 1 Replies

AJAX :: Calling Non-static Methods From A Static Method?

Jun 30, 2010

I did some research after posting. All I found was simple examples for no-layer architectures, like connecting to a database from your aspx page, so, in a corporate environment, it is unnaceptable.

I need to call a server-side method (using ASP.NET Ajax) in a 3-layer architecture.

For example, my Default.aspx contains a method LoadProducts().

[Code]....

[Code]....

This cannot change. There is no way to convert Business and Data layers to static.

How can I call the LoadProducts() method using ASP.NET Ajax?

View 2 Replies

Public Static Variable Declared In Public Static Class MyGlobals In A 'Code File' Template?

Jan 27, 2011

I have a question about C Sharp ASP.NET:Is there a difference (in code speed, resources) between:public static variable declared in public static class MyGlobals in a 'Code File' template;and the variable declared in a normal 'Class File' template;I use this variable in 2 different Class Files and also in _Default Page codebehind cs file.In fact in my case I need about 20 global variables of type List<string>.

View 9 Replies

Working With Static Variables / Store The User Specific Information In Static Variables?

Mar 5, 2011

whats the exact use of static variables in overall programming in .net and for asp.net...

Recently i went for the interview where interviewer asked me 2 question which i was not sure for the same..

whats the use of session object, i said sessions are the server side object, they are used when you want to store user specific data at server side, then he asked what if i want to use static variables for the same, i was mum, can anyone tell me how asp.net will behave if i store the user specific information in static variables.If i use cookies which are the best option to store the data at client side (not sensitive one), but what if user has disabled cookies on his machine, will my application would crash.

View 3 Replies

Difference Between Adding Code In The PreLoad Event Handler And At The Top Of The Load Event Handler?

Oct 3, 2010

Is there a technical reason for the existence of Page.PreLoad or is this just convenience to have a place where you can neatly place code that always have to be executed before the Load code? Is there a difference between adding code in the PreLoad event handler and adding code at the top of the Load event handler? And what would be a typical scenario where you use PreLoad?

View 2 Replies

Handler And Generic Handler?

Mar 16, 2010

In Visual Studio 2010, when you say new Item, you can see Asp.NET Handler and Generic Handler. Can you tell me what's the difference, I think it came with .NET 4.0 because I couldn't find related thins on Google.

View 1 Replies

MVC :: Parameters Not Mapping To Action

Nov 12, 2010

I have a problem getting a (very simple wep app this is) parameter to map into my action. The controller code action:

[Code]....
My global.asax:

[Code]....

Problem: Calling a url like /Ax/Delete/525782 always returns the 'ParameterNotFound'-view. Its been bugging me for several hours

View 4 Replies

Mapping Xml Path In A Web Project?

Nov 10, 2010

I am using a xml file to get some values.

I am reading xml like this

Dataset ds = new Dataset();

ds.readXml(Server.MapPath("XMLFILE.xml");

I want to know that is this a better method to read xml file or storing xml path in web.config file and then using it is a better choice.

View 3 Replies

Mapping Route And Parameters In MVC?

Mar 29, 2010

In Area VIPUsers I have controller ProfileController and other controllers.

If I want every method in ProfileController to have parameter (id) and every method in other controllers to have parameter (userid and id) how would I map it?

Would it be

context.MapRoute("ProfileMapping", "VIPUsers/Profile/{action}/{id}",
new {controller="ManageUsers", id=""});

and then map a default one for all the controllers?

context.MapRoute("Default", "VIPUsers/{controller}/{action}/{userId}/{id}",
new {action="Index", userId="", id = ""});

If I go to a page on ProfileController and give it two parameters after {action} (VIPUsers/Profile/SomeAction/4/4/), it'd use the second mapped route. Is that correct?

View 1 Replies

ADO.NET :: Foreign Key Not Mapping In .edmx?

Nov 16, 2010

So I am working with a database and am trying to get my model code working.I have a situation where I have a table called accounts that for simplicity has 3 columns

accountid, accounttype, parentid

basically its a parent child relationship. if parentid is null its a parent, its not its a child of the accountid.Im running into problems getting the .edmx file mapping. parentid is a foriegn key on the table.

how can access the parentid column? i can see it in account navigation account1 but Im not sure how to get access to it in my linq query

View 3 Replies

MVC Root-mapping On IIS6?

Aug 18, 2010

I've set up a web app on IIS6 with a "{controller}.mvc/..."-mapping. Everything is running fine - except for the root-path (http://www.myapp.com). The additional routes.MapRoute for "Root" is applied in global.asax (as in the MS-example "Listing 2 - Global.asax (modified with extensions)").In VS2010 debugging mode everything (including the root) works - as well as in the "published" app (on Win7 IIS 7.5). I've copied the whole published app to the IIS6.

View 4 Replies

.net - MVC 2 View Mapping Mechanism?

Sep 11, 2010

I wonder mapping mechanism from controllers to views. I can not understand how mapping can be possible If we just return value of View() method. Controller class's View() method call overloaded View method with null parameters. But how can be possible to mapping to views with none specified returning value of View() method ?

View 2 Replies

Mapping Control And DB Field?

Jan 8, 2011

I have a DB's table with control_name, field_name Control_name is the web form's control name and field_name is the table's field.

I want to dynamically insert the content of the control to the particular field.

How do i do that? I do not wish to generate the SQL in C# code dynamically with string.

View 2 Replies

Web Forms :: Web Pge Using Microsoft Mapping?

Mar 15, 2011

We have a requirement to post the status of installations on a Web based map. I remember seeing smething like this at the Visual Studio 2010 launch event. As I recall it was a Silverlight based web service.Has anyone done something similar?e.g. US Map, with GREEN/RED/YELLOW circles on specific Cities or GPS coordinates showing current status overall. Click on the Circle and filter down to the specific item you are looking for the status on, and would show Equipment installed, Progress complete, etc.

View 2 Replies







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