I am working on a website web site where each user has a culture setting to allow control of resources displayed. The main page has two views, one the log on screen, the second the main menu.
When first loaded the page displays with the culture settings of the previous user (if any). If I then log on as a user with a different culture setting the view changes to the main menu without changing the culture. Go to another page and the user's correct culture settings are picked up, go back to the main menu, uses the correct culture etc.
This is logical but is there a way (without redesigning the site to have a separate log in page and main menu) to reset the culture to the new user's when switching view?
response.redirect does the job
Related
I have a asp.net webpage that displays a link Login or Logout depending on a session variable "IsLogged". I want to implement caching in that page. But after applying caching the Login/Logout becomes inconsistent with the session variable. What is the best approach to address this problem so that I can also apply caching in that page?
Thanks,
Partha
I am not sure how you are caching specifically but you could break your page up into two user controls (ascx).
Your aspx page could contain the user control to that shows the login information (make sure that when you load the user control with a dynamic url so that the caching ignores it because the address is diff everytime like:
yourSessionInfo.ascx?stopcache=32487239875 (the number could be just current time in ticks)
You just need something that changes in your url so that the page 'looks' like it is different and reloads.
Then have the rest of your page in another user control that has a static url:
yourRestOfPage.asx
Notice nothing changing in the url so page can be cached.
Not sure if this will solve your exact problem but it should at least start you down the right path.
I have an ASP.Net(VB.Net) project which has various modules/functionality. I want to give users the freedom to set their own default startup page.
I don't know how to get a head-start implementing this feature.
Also, I am NOT using MVC
On the master page place some control to choose current page as default (i.e. button or checkbox). After user has select current page as default you can store the page address to user's profile or any storage you like.
Set the site start page like Default.aspx and in the Page_Load method of this page read user's saved default page if exists and redirect to it.
You'd want to set up a way for the User to store their preferred home page in your database (or your preferred method). Once that's done you should be able to do this in a simple fashion:
ASP.NET WebForms:
On the Master Page / Default page, check to see if they're logged in in your Page_Load event.
If they are, check to see if they have a start up page saved, if they do then use Response.Redirect and send them to their preferred location.
If they don't, or aren't logged in, then show them the default page.
ASP.NET MVC:
On the HomeController's Index method check to see if they're logged in.
If they are, check to see if they have a start up page saved, if they do then use RedirectToAction and send them to their preferred location.
If they don't, or aren't logged in, then show them the default view.
There are probably plenty of other ways to accomplish this as well, but this should be a straight forward way to get your started.
I come from ASP.NET and I am learning Flex now. I don't know if I can do what I want in flex, so imagine this in ASP: I have an aspx page that loads a Login.ascx control, the control checks if login is correct, and if so the aspx page loads the XXX.ascx control (so there is only one control visible).
I want to do more or less the same in Flex: I have the main application with the code that connects to the database, check the login, and if its correct it loads a new module. I have made everything until the module load, I mean, I have the main application (Login.mxml) associated to a Login.as, and a Module.mxml associated to a Module.as. When the user press the login button (in Login.mxml), a method is fired and checks the login. If it is correct, it shows the new module.
My problem is that it is shown in the same page that the login page, instead of "changing" the page. I have used two ways to do that: ModuleLoader and PopUpManager, and both load the new module in the same page.
QUESTION: How can I load, inside an application, a Flex module in a different page?
If you want to build Applications, I strongly suggest you get out of the page mindset. Excel doesn't have the concept of pages in it's UI as one example. You wouldn't have links tot he formula editor or whatnot.
But, that said you should probably investigate the BrowserManager and how to Deep Link into a flex Application. Then you can change the URL in the browser's address bar when your application view change.
If your adamant about applying the page paradigm to application building
You could also use the navigatetoURL to redirect to a different page which would load a new flex applications.
I've implemented an ASP.NET web application that supports 5 different languages.
The web application has 5 .resx files that contain the resources required in order to display the website in the languages it supports. To display the site in the language that the user has selected, I've been setting the Thread.CurrentThread.CurrentUICulture and Thread.CurrentThread.CurrentUICulture in the InitializeCulture page event.
Some of the pages have UpdatePanels wrapped around the content.
From what I remember (from 3 years ago when I was researching globalization), in order to change cultures you have to do a full page update.
So here's the problem:
The user opens a tab and starts working on some page that has an UpdatePanel surrounding the content.
Then the user opens another tab and selects a new language.
The user returns to the original tab and causes a postback to the server...at this point the page never returns control to the user.
How do I get around this problem?
Thanks,
-Frinny
To get around this problem I ended up storing the user's cultural settings into a HiddenField for each page (did this in the MasterPage really). This way I can access the user's original culture/language settings in the Page InitializeCulture event. The user would have to click enter on the URL or exit the page to use the "default" language/culture selected in the other tab.
I have an ASP.NET website with some independent sections. I need a way to turn on/off the different sections (each section is in it's own directory) based on the user selection. How can I prevent the users from accessing sections that are turned off?
The solution I ended up using was to make a new class ModulePage that inherited Page. In the OnInit it would check an Abstract property I added IxModule to see if that that module was turned on or off, if it was on the page will display and if it is not the user is redirected to another page. Each page in each module has to be change to inherit ModulePage and then just specify the IxModule value. It is working very well.
you can require a log-in for those pages. I'm not sure if that's what you want.
You could look for a specific web.config app setting for each section. Each section would need a web.config setting with a sectionID app setting element.
If your using master pages, just do a check in the master's on PageLoad and check to see if the user has access to the sectionID store in the config setting. Store the section IDs that the current user has access to in the session or a cookie or something (not sure what type of security your looking for). Have one global function to lookup the app setting from the web.config. Depending on which page is calling it (from which directory) you will get the specific section's ID.
If the user does not have access redirect or show a message or something.