Get Page.Theme From HttpHandler Page?
Jan 31, 2010There is an HttpHandler that needs to access the theme name, so you can rebuild the image name depending on the theme name.ow can I access the Theme property
View 2 RepliesThere is an HttpHandler that needs to access the theme name, so you can rebuild the image name depending on the theme name.ow can I access the Theme property
View 2 RepliesI imagine this would be simple, but I can't find an answer. We set the theme of a page based on a query string parameter (like '?theme=theme1' etc). I just want to know if there is an easy way to tell the theme name is valid, before setting it, or catching and handling the error if it is invalid. The error I get if the theme does not exists is:
"Theme 'theme1' cannot be found in the application or global theme directories."
I am not sure when the exception is thrown. All I can think of is searching the folder, but I would think there would be a simpler way.
In web.config I have this line:
<
pages
theme="BaseTheme">
On the page, I have this line:
<%
@
Page
Language="C#"
AutoEventWireup="true"
Theme
="Theme1"
Inherits="_Default"
Codebehind="Default.aspx.cs" %>
I thought Theme1 should be additional to BaseTheme with Theme1 has higher priority in case of conflict. But Theme1 seems to have replaced BaseTheme completely and nothing in BaseTheme shows on the Default.aspx page. If this is the right behaviol, how to add additional theme to a page?
I've got the following Setup in my Theme:
App_ThemesDefaultStyleSheet.css
App_ThemesDefaultPrintStyleSheet.css
The PrintStyleSheet.css file has a set of printing css rules set in them wrapped in an @Media Print { } block.
I need a way to programmatically remove the PrintStyleSheet.css from the list of css files for ASP.NET to inject based on some flags. (Some instances we want to print the site verbatim without custom formatting).
I know i could build a seperate theme without the PrintStyleSheet.css in it and switch the theme programmatically, however this would introduce duplication of my master stylesheet which is not acceptable.
We have a page that creates a printable version of the customer's bill. We are using themes via <pages styleSheetTheme="CityDesign">. This page is not using the Master page nor has any style sheet associated with it. I have added <%@ Page Language="C#" EnableTheming="false" Theme="" %> to the page and protected void Page_PreInit(object sender, EventArgs e) { Page.Theme = String.Empty;} to the code behind. The page still has the theme applied.
View 1 RepliesI'm using a flash app to upload images (EAFlashUpload - http://www.easyalgo.com/eaflashupload.aspx) which works great, but there's a problem.For reasons beyond my understanding, if a theme (page theme = "white") is declared in the web.config, it doesn't work correctly; even if there is nothing in the theme folder at all! Oddly though, it's happy if the theme is set at the page level. Problem is, I don't want to have to hard code the page theme into every page. Is there another place I can set the page theme? I've tried in the code behind of the master page (pre_int), and also adding a web user control with some code behind to the master page.
View 7 RepliesI am developing a small application in asp.net (writing in c#). In my application I am using jquery to perform asynchronous call to the server. I have an http handler that listens in to the requests and does what it needs to do.
Problems start when in the handler I need to access information stored in the page , from where the asynchronous call started. When I try this:
Page page = HttpContext.Current.Handler as Page;
I don't get a page.
How else can I access the page itself?
I have a function that sets the Theme for the page but I want to define this in a MasterPage for each page that uses that MasterPage. This seems like the most likely way to do this to me, am I doing something wrong?
Here is what I have:
[Code]....
If i copy this to an ASPX page it works but it doesn't seem to work at all in a MasterPage.
I have a Asp.Net Web Application that uses Themes. Inside the theme directory are 9 *.css files.
I've published the Web Application months ago on a IIS 7.5 (and updated regularry). If I browse the site from my computer, my private computer or some virtual machines at a hosting facility, the site will be perfectly rendered.
However, some employees of the company we created the page for are recently having display issues. I was just able to reproduce the issue via remote session and found out, that only 8 of the 9 styles in the selected Theme directory are included into the page. (IE developer toolbar showed the this)
The client is using Internet Explorer in version 8.
The problem does not only seem to affect employees of the same company rather than visitors from outside as well.The name of the stylesheet, that sometimes not included into the page is called style.css.
I've checked if the file was not accessible from the computer I created the remote session with, but that was not the case. The style.css was browsable. For now I'd try to move the style.css out of the App_Themes directory and include it manually via the MasterPage.
Update: I also discovered that some
<asp:Images ImageURl="~/images/mypic.png">
are also not being shown, just the red X for image not found. Maybe that's related? I looked for the Internet Explorer setting multimedia -> show images, it was checked. I'll try to replace the pngs with jpgs for now.
I am currently working on a project where I want to implement a bit of logic for each .aspx viewed.My idea was to use an httphandler that will target *.aspx, and in the handler, I would do my bit of logic, such as printing out: This is the xth page you have visited in this session.I am curious if there are any problems with my idea or is there a more proper solution I am not aware of.Though I have tried implementing my solution, I run into an infinite loop. After I complete my logic with the handler, I redirect to the same page, but that of course calls the same handler. Is there a way to bypass the handler on the redirect or a specific way to execute the same page without accessing the handler.
How To Redirect from httphandler(.ashx) to an (.aspx) page in the same application ?
[URL]
can some expert confirm better approach
You must have noticed one link in yahoo.com, msn.com or other popular websites named "Page Options". When you click this link you get a popup displaying different small several color icons. After clicking one of these icons your page theme changes without entire page refresh. Now you are able to see the same page with different look and feel.
How does it happen and what it takes to do it? Is this possible in ASP.NET? If yes, how to do it?
I'm wanting to adjust this code to pull the theme name from a database table, instead of just manually assigning a theme in the file. This way a site administrator can set the theme dynamically. If never done this with a global.asax file, so I'm not sure what the best way is to accomplish it?
Here's the code that needs tweaked:
[Code]....
The database table could be "ThemeName" with rows ID & Theme. If performing this in the global.asax file will cause any big performance issues.
I am using nifty corners to display rounded div's. I pasted this code into a normal web page and it fires correctly. But when I move the code back into a master page the script for windows load doesn't fire. The code is below. why the onload scrip isn't firing. The actual web form only declares the content place holders...no actual html.
To get nifty corners it is [URL] and scroll to download link. But this isn't necessary.
[Code]....
I have IIS 7.5 with an ASP.NET application. The application must run with IIS Classic Mode.
I have one HttpHandler that serves all the Request:
<httpHandlers>
<add verb="*" path="*.aspx" type=".....HandlerFactory..." />
</httpHandlers>
The problem is that i can't establish a Default Document to an non phyisical file. I want that the Default Page be : Home.aspx (which is a non phyisical file).
So when I go: [URL] I get an error: HTTP Error 403.14 - Forbidden The Web server is configured to not list the contents of this directory.
I do not want to make a REDIRECT.
Is there any way to accomplish this without having to create a index.html to redirect to Home.aspx?
I want to set theme for my Web Application Master Page in .NET 2.0 and VB.
So puting one asp:Image in my Master page and I am trying to apply theme to change the ImgeUrl.
But since I am not geting the Page_PreInit event on Master page, I am not able to apply theme from Master page
I am working on Themes. Till now I can sussessfully change the Single Page theme when my user logs in.
I Used :
Page.Theme = "RedTheme";
and redirect it.
But if i take master page then i unable to apply the selected theme to all pages. My User can able change theme now. But only for single page. How to apply for all pages?
I tried this link but I wonder is it possible doing the same thing without page refresh?
View 1 Replieswith this code website works perfect
<configuration>
<system.web>
<httpHandlers>
</httpHandlers>
</system.web>
</configuration>
but when I add
<add path="ThumbHandler.ashx" verb="*" type="Delshad.WebControls.ThumbHandler,Delshad.ThumbPic"/>
or
<add verb="GET" path="CaptchaImage.axd"
type="MSCaptcha.CaptchaImageHandler, MSCaptcha" />
in httphandlers section when I go in my site it is only a blank page!
before In other two host there wasent problem but this is a new host and I face with this problem.also in local there isn't any problem.
I have problem when I use "Web Deployment" project to deploy web site by VS.NET 2005. Although, file .aspx does not contain theme in section page directive, web deployment add theme as same as value of Web.config automatically when deploy project.
View 3 RepliesMy master page looks like:
<head runat="server">
<title>
<asp:ContentPlaceHolder ID="PageTitlePlaceHolder" runat="server" />
</title>
Content pages look like:
<asp:Content ID="TitleContent1"
ContentPlaceHolderID="PageTitlePlaceHolder" runat="Server">
My Page
</asp:Content>
This works by placing the content page specific title on the page ("My Page" in this example). Now I want to add a global prefix to the title in my master page for the site name. So I want:
<head runat="server">
<title>
Example.com:
<asp:ContentPlaceHolder ID="PageTitlePlaceHolder" runat="server" />
</title>
However, when I do this content pages are still rendered without "Example.com" in the tile, it's like it's ignored.
Why is this happening and how can I achieve this?
I want to share a common page load and page init events sequence between Master page and child page and User Control as described below:
Let us have the following components:-
1. TestMaster.master -> It is the master page
2. TestChild.aspx -> It is the Child page
3. TestUserContrl.ascx -> It is the UserControl present within the TestMaster.master page.
[code]...
I am using Master page and Content page combination.But how can i access <body> tag and it's event (onload, onunload) of Master page in .aspx page that is not a content page.
View 12 RepliesI have a master page homeMaster.aspx and many content pages. However the situation is I have few .html pages. Now when a user clicks on a link the html page should get loaded.inside the master page. The problem is these are .html and not content page with .aspx.
View 4 RepliesI've encountered a problem when I put a treeview in a page which is using master page. The treeview style doesn't apply.For example, I set the nodes with different colors in different levels. But the treeview nodes are still displayed in the default color(bule).
The treeview code is :
[Code]....
If I use these code in a page which doesn't use a master page. The nodes are shown in colors.