How To Track And Load A Specific User's Information
Jan 21, 2011
I'm making a small portal in ASP.net (with C#.net4) where users can login and add, edit their personal information (PI). But I don't get how to load information (stored in a SQL server DB) in the page when a specific user is logged in.
For example: If Sam is logged in, he can view his PI. When Vicky is logged in, she can view her PI.
The Register action gets called in the Account controller, showing the RegisterViewModel in the Register.aspx view. The form in Register.aspx is submitted/posted with answers to all of the form questions, except for the security question answers. If the user is created successfully, then I'd like to go to the GoToSecurityQuestions view using the code - return RedirectToAction("GoToSecurityQuestions", "Account"); I need to be able to keep track of the user name or ID of the newly created user so that I can persist the security questions to the database records related to the user. What's the best way to keep track of the user info between the [HttpPost] Register( ) and the [HttpGet] GoToSecurityQuestions( ) ?
[HttpGet] public ViewResult Register() { return View(new RegisterViewModel()); }
I have a need to display user-specific information in my master page. As a result, I have set up all of my controllers to be inherited from a "master" controller. This has worked well for other aspects of the master page, such as displaying random quotes. However, while using this technique to incorporate the user-specific information, I ran into a problem where, when I check the Request.IsAuthenticated value, the Request object is null.
Here is my "master" controller:
[Code]....
Curiously - at least to me - is that the Request object becomes populated by the time program flow hits the Home Controller: [Code]....
I have a online game (written in ASP) which i have finally decided to convert to ASP.NET. However i cannot seem to link the login ID's of users to their specific details in the database. I.E when Joe Bloggs logs in, he will be shown the team information for just his club, not every club. in ASP I use code similar to this below
[Code]....
im not convinced that is the right syntax to be using, but when i execute the code in Query Builder it is showing me the correct data (that i expect to see). So im wondering if there is something else im missing? Is there something extra that i need to be adding in Web.Config file or elsewhere?
I have a website that I want to distinguish the traffic generate by myself and by others.
I use wireless router to go on internet, so I have a static internal IP and a dynamic external IP.
Is there any way I could track the information of my own machine when I access any of the page of my website? Track the machine name? Track the internal IP?
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.
My website uses forms auth and I am trying to create a load balancer (hardware) rule which will keep track of sessions based on the aspxauth cookie. Is it safe assume that the value of the cookie is unique?
Imports System.Net Imports System.IO Imports System.Data Partial Class Test01 Inherits System.Web.UI.Page Dim T01String As String Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim WRequest As WebRequest = WebRequest.Create([URL]) Dim WResponse As WebResponse = WRequest.GetResponse() Dim WStream As Stream = WResponse.GetResponseStream() Dim WStreamReader As New StreamReader(WStream, Encoding.UTF8) T01Location = WStreamReader.ReadToEnd() WResponse.Close() WStreamReader.Close() End Sub End Class
In this example, a stream of data is captured from the Wikipedia website. I am looking for resources/options to assist in (a) returning specific information from a website based on criterion to be stated in the code (rather than the entire unformatted HTML data, for example), and (b) providing a variable value for an entry required for a particular website, then returning the stream based on the result (example: allowing the entry of an address as a variable value and then returning the zip code from the USPS website). Basically, the idea is to find the correct code configuration for allowing "wildcards" when returning a stream of data from a specific website.
Each row has a drop down, a text box and an "add" link. I'd like for someone to select something in the drop down, edit something in the text box and pass that information to an Action in the Controller.
I know i can do something like this:
[Code]....
[Code]....
Which is kind of gross - id like to do just call one action, that passes the selected drop down value, the textbox value and call just the one action, is it possible to do something like this:
[Code]....
Where i pass the Dropdownlist selection and the textbox value to my controller specifically
how can I retrieve information when the user clicked on a specific link without opening a new web page? The information is stored in the database which is through web service. For example, when the user click on a specific link, e.g the date 28 February 2010, the datagrid will display the information on 28 February 2010.
using vs2008, asp.net, c# .net3.5 In this control;s ActiveTabChanged event, the ActiveTabIndex property stays 0 no matter which of the 3 tabs I select. Why is that? I want to keep track of which tab the user has selected and store this in the seesion variable so when refresh or bookmark by the user is would done properly. I was advised to possibly do this by saving the ActTab instead of the ActiveTabIndex. The problem then is how do I set the ActiveTab of the Tabcontainer, I mean how do I cast the Seesion variable so I can assign it like tabScien.ActiveTab = (castType)(Session["SavedActiveTab"]);
My intention is to give the user a flexible user control on a master page that does the following:
When navigating, a child page will pass the URL (with querystring) and PageTitle to the user control. The user control will take those two parameters and insert them as a "breadcrumb" object at first index of a List<breadcrumb> collection
This part works fine through the use of a Repeater with a LinkButton contained in an ItemTemplate. The user sees each of the pages he has been visiting in descending order, the provided benefit is a quick way to re-open records they have recently modified or created.
The part I'm having trouble handling is what happens when the user clicks the LinkButton, which is that the child page adds a new reference to the URL at the beginning of the List<> collection and I cannot seem to control the behavior of removing the LinkButton before it gets re-created. What I've tried doing is:
While that should work, my CreateBreadCrumb(string url, string title) function gets called by the child page before the UserControl detects the Repeater1_ItemCommand event, so in effect it appears that the wrong ItemIndex is being used for removal.
We have 2 asp.net web servers working through the LoadBalancer that are accessible externally. Earlier, for all applications we did logging into DB. Now we have 1 more app that doesn't work with DB, it is used for 'messages transferring'. On TEST environment it does logging into files into a local folder.
If we deploy it "as is" to PROD we will have 2 separate log files... that is not very good idea. Connecting to DB just for logging doesn't seem reasonable too...
Possible solution could be store log file into a shared folder somewhere on another server.
I have the membership provider and the create user with tow steps, one of the steps contains a custom registration form, for each created user data will be in the database, and there is an account page shows the data that the new created user did insert during the registration process on the custom registration page,
the problem, when the user is created and logged into his account page, this account page shows only the information for the first created user, not the info on the logged in user , but the logged in user data still saved in database and not showing on his account page?
I have a website where different comapny and users can login. Till now I have not seen any issue on IE 6. But in case of one account, when try to login the website, users are getting security information "This page contains both secure and non-secure items.
I can reproduce the same easily for the same customer but not happening for any other customer. I have "ReportViewer" control (gets rendered as iframes) on the page.
In this scenario, whether user selectes "Yes" or "No" button, the home page with charts loads 30% and other controls remains invisible. Though I see same out in "View source" for this and other customers. We dont change anything much then the data and charts for the users. We use https for this website and has few links with "http" in page. But then this is same for all the users, but it happens only in case of one customer.
I have set up a number of sub domains and when for example, a user enters their sub domain x.example.co.uk I want their avatar / logo to load. So in essence, the code will detect the sub domain url and load their logo. I want this to work for muiltiple sub domains. It doesn't appear to be too complex, however I have no clue as to what code would be required to get this in place. I am assuming it would call on the css...
I have the above statement in the Page_Load sub on the masterpage. When I run "Start Debugging" from VS 2008 it works fine. However, when I publish the Web Site (on the same machine) and try to load the site from our internal network, the information is blank.