I've a problem with serialization both in silverlight and asp.net.
I've added this line to my web.config to set the culture of my web application:
<globalization uiCulture="fr-CA" culture="fr-CA"/>
Problem: when my computer is set to another culture for example en-UK, my application is taking that culture instead of the one i set in the web.config.
Your site might be honoring the browser's stated language preference.
Check the Language settings in the browser, and try setting enableClientBasedCulture in your web.config to false, per this MSDN article.
Also worth making sure you try other basic troubleshooting steps, like resetting IIS (assuming you're not using the built-in Visual Studio development web server).
If those steps fail, I would roll up my sleeves and try some serious debugging. It's possible something else is overriding your setting, or that ASP.NET isn't finding your .resx resource file.
Try overriding the InitializeCulture method on a page and hardcoding the language there (assuming you're using Webforms). That will also let you set a breakpoint while the page is loading and check what the UICulture is set to.
If the cultures are getting set properly, I'd look to make sure everything is set up correctly with your .resx. Those things can be a pain to get configured in my experience.
It might be a good idea to set up a simple HelloWorld demo app to try to reproduce and isolate the problem. Here's a decent walk-through so you can check your setup steps.
Related
I am working on a Web application project and although I am an experienced Visual Studio developer almost all of that has been in WinForms, console apps, Services, etc. That is, I have very little experience with using VS to develop web pages (Web Forms, asp.net, etc.), however, I am learning how to apply my previous Web page knowledge to VS.
One thing that has been throwing me for a while is how to apply additional CSS files in development, that should not be used in production (because they are already there). Specifically, I am working on a set of pages (DNN module) that is being deployed into a larger website context.
This all works fine, except the VS Web Page Design Editor is nigh useless because it's WYSIWYG rendering is not even remotely close to what the page looks like on the site. I know why this is happening: the site (and DNN) have their own set of CSS files that are getting applied/added to the page.
I know that I could just add those same style sheets to my web page in development (using <link href=...> tags?), however, then the web page would be deployed referencing these CSS files twice (there's a bunch of them too).
So my question is, is there any easy solution to this? Is there some setting somewhere that I can just say "use these additional CSS files in development or in the Design Editor"? (I hHve tried to google this, etc. but I just find dozens/hundreds of articles about how to add or edit CSS in Visual Studio)
Unfortunately I think that may have mis-explained my need somewhat. The issue really is not a development vs production issues, but rather an IDE vs execution issue. When debugging the code or otherwise running it in development, it is still within the DNN test environment we have setup, so it does have the extra file even here.
This is really about the HTML designer, when i am using it it does not have these extra style sheets, so I cannot see what the work I am doing really looks like. Instead, i have to run it every time I want to see whether any change i make looks like it is supposed to. This gets extremely onerous, especially with how slow DNN is to compile and reload.
Hmm, do you have your web project setup to run on IIS instead of IIS Express?
Something I do is often just work in the project then Save and if needed build. Then browse to the Site on my machines IIS instance (right click file in solution explorer and select browse if using ASP.NET Web forms).
Once I have done that I can refresh my page. I also use #if Debug in my code to bypass user login and etc to make round tripping faster...
On the website I'm building we are using the built in bundling and minification.
We render our scripts by using the #Scripts.Render
#Scripts.Render("~/bundles/scripts")
it generates a link like:
bundles/scripts?v=3-DUUAAegZl4yp1O4V0VL0GnJ0U6gT3De8yKb41lfGs1
Here I thought that the hash:
v=3-DUUAAegZl4yp1O4V0VL0GnJ0U6gT3De8yKb41lfGs1
would be smart and change if we made changes to the inlcuded scripts but it seems like that is not the case.
Now when we are trying to implement a custom cdn for out bundling it fails on updates since the hash never seems to change.
Does anyone know of a solution to change the hash when the script changes or if we are doing something wring?
Edit:
I noticed that there is a difference in behavior depending on what environment I'm using.
Local development it seems to be working but it doesn't work on the staging server.
Should there be a difference?
Edit2:
Seems to be working as it should on production servers as well. Will have to do more research on what the cause can be.
Edit3:
Seem that the one causing the problem was in the registry LogRewrittenUrlEnabled was set to false to allow url rewrites at the same time as using dynamic content compression (gzip) so will have to find another way to enable this
You're right, the cache-buster hash should change if you change the contents of a script. There's some useful information about how the cache for bundling works that may help you here ASP.NET MVC Bundling cache. (Detecting css files changes) (internal behaviour).
The problem was that on the server we had in the registry
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\InetStp\Rewrite /v LogRewrittenUrlEnabled set to false
And if you have that then the cache-buster hash is not refreshing when the content i bundle is changed.
I set "maintainScrollPositionOnPostBack=true" in my web.config file for the shake of requirement. Everything is ok, but the problem is this global setting ignore my control.focus() property.
Eg:
myLable.focus();
myLable is not get focused. How can I get focus over controls regardless of "maintainScrollPositionOnPostBack" property? any help would be greatly appreciated...!!!
set MaintainScrollPositionOnPostBack=false; just before where you want to use focus with your label. This article has detailed discussion how it works underneath How MaintainScrollPositionOnPostback works
maintainScrollPositionOnPostBack relies on browser config entries in the Web.Config which are no longer supported or recommended by Microsoft - as it is, the versions of the browsers it supports are antiquated.
Use jQuery to achieve this effect, plus it's cross-browser friendly.
FYI: Here's another was to handle this:
http://www.kodergurl.com/2010/08/maintain-scroll-position-on-post-back.html
Summary
I have a web-application with more than 5 themes. Each themes covers a completely different style for different customers. whenever we publish a new version of our application we send it for all of customers.
The problem.
We specify theme in web.config file in <Page> tag. like
<page theme="Theme1" /> // or Theme2 for second customer.
with this approach we easily change the style of application from each other without writing codes which needs a new publish for each one.
With changing the theme="Theme1". nothing change and we didn't write a code in application , so why changing theme don't change the theme and we need a new publish?
we want to change it in web.config or somewhere else and with changing it the theme change without needing a new publish for each one.
Update :
I Publish Once and then copy the published version for each customer (5 times) then in each web.config file I change the theme="CustomerTheme". but only the theme which was active in publish process is usable in all of 5 versions and other 4 themes are un-usable
--
Actually the main question is that why changes in Web.Config need a different publish while it is XML and do not need a complie. I should Add this note that, App_Theme include all of 5 themes so that all of them Compiles and are ready to use
--
This is the way I publish the application
Photo Link
Update 2
here IFound the exact problem reported by someone else. he resolve the problem but I can't underestand how he resolved this Issue. can anybody tell me how he resolved the issue?
he used aspnet_compiler command and told that automatically ADDS the 'theme' on the Page directive
(first post is the question and the last post is the answer)
http://bytes.com/topic/asp-net/answers/495850-themes-web-config
If I understood you correctly, you have one theme for each customer and that will not change?
Still, I do not understand your publishing scenario? Why do you want to change the Theme if each customer has its own web application?
Nevertheless, how about you check the request url in the codebehind and set the Theme Name programatically?
Pseudo-code: (you need to have this piece of code executed on every request. You could write an HTTPHandler for this, or use the BeginRequest Event in the global.asax. You also need to find which property provides the necessary URL information)
switch(Request.URL)
{
case "www.customer1.com":
Theme = "Customer1";
break;
case "www.customer2.com":
Theme = "Customer2":
break;
}
Did you publish the app as precompiled? If so this could be the cause.
Why not store the theme to use in a database table and access it there rather than the web.config? This should then be truly 'on the fly'.
Even though this is a really old post, I don't think the accepted answer is the best one. On this link, https://bytes.com/topic/asp-net/answers/495850-themes-web-config is a correct answer, but not as clear as it should.
He mentioned that the compiler is adding the theme to every page, so then it can't be changed by web.config file on the server. But he didn't say what to do to avoid this and it is pretty simple. You just have to remove the theme='Theme1' from web.config before compiling the web site. If it is not there, then the compiler would not set the theme to every page and you can change the theme just by web.config on every server you like with the same exact code.
In MOSS 2007, is there a way I can insert a piece of code I wrote to run every time I create a site from a ready made template ??
You should do it with a feature, and give it a feature receiver that contains your code. Attach the feature to the site template. If you've made the template yourself, you can simply add it to its onet.xml. If it's a standard template, you can use feature stapling, which connects your new feature to an existing site template.
Note that in either case, your code will not run for sites that exist already, (unless you manually activate the feature there.)
Yes, you certainly can. I wrote a post on this a few months back. You have two options, either a feature with a feature activated handler, or using a ProvisionAssembly in your site defintions webtemp*.xml file. The latter is also how MOSS does the Publishing portal multi-site setup.
I wrote a short article on this a few months back:
http://furuknap.blogspot.com/2008/06/question-from-forum-post-at-httpwww.html
.b