MVC :: Generating A Request ID And Keeping Track Of It?
Dec 14, 2010
I am trying to Generating a Request ID and keeping track of it from request to request.I just want to get the previous request number and bump it up by 1 and log it so I can keep track of the number of requests come to my page.I was looking into TempDataDictionary but that is not working for me.I am new to ASP.NET MVC soexcuse my ignorance.
I'm creating a ASP MVC application. And because of the complex authorization i'm trying to build my own login system. (So i'm not using asp membership providers, and related classes).Now i'm able to create new accounts in the database with hashed passwords.But how do i keep track that a user is logged in.Is generating a long random number and putting this with the userID in the database and cookie enough?
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 am trying to keep track of prints that are made for a page. The page has Print this page link. And the code for it is like below: This is written in .cs file as there are many conditions for displaying this. And i am appending here using String Builder.
I have a login control in my login page. The user can attempt to login unsuccessfully for 5 times after that the user account will get locked and the administrator can unlock the locked user.
Here, i need to display the login attempt count along with the error message "your login attempt failed". I have tried with the viewstate but it is not working fine.
When you click the edit button in detailsview I want it to store some values in "PreviousAddress" and "PreviousVehicle" to show what the data used to be before it was edited... Just wondering what would be the best way of doing this?
I want to save each request to the website. In general I want to include the following information: User IP, The web site url, user-if-exist, date-time. Response time, response success-failed status. Is it reasonable to collect the 1 and 2 in the same action? (like same HttpModule)? Do you know about any existing structure that I can follow that track every request/response-status to the website? The data need to be logged to sql server.
I have three pages calculator1.aspx, calculator2.aspx and Menu.aspx. On each calculator page i have a button that redirect me to Menu page and on Menu page i have to go back to Calculator1 or calculator2 page from where the request initiated. So how can i differentiate from which page my request come when im on Menu page.
I'm trying to allow a web form to use a PayPal buy it now. The relevant page is: [URL]
Based on which radio button a user selects, depends on which paypal button they are "redirected" to. The subscriptions are easy - they are just a simple redirect.
The last option, requires a user select a venue. For this, i require to use the form below:
i am using an div tag for that i am keeping an scroll bar. which is an slider control. now here i need to replace the vertical line image with my own image . and the scroll image to. so it possiable to achive this in the slider control what we are using
I'm utterly new to APS.NET and in particular the MVC model...! I have a Telerik RadGrid control that I'm using. Until now (following NerdDinner) I was having the Model passed back to the view and this provided access to the various properties I wanted.
.. lets me loop around the Model object and extract Customer data. This RadGrid control, however, needs me to use an EntityDataSource (hooked up via the designer). Does this have implications for maintaing the MVC pattern? I'm a little confused about how the EntityDataSource works in relation to my Model.EDIT: I do know there is an MVC version of the RadGrid but we also need the RadScheduler and a few others.. besides that, I'd still like to know the impact.
I need to keep my basket more permanent I have two options and I want to choose the best one.
I have eCommerce web site application in asp.net and there is a basket include products which are selected by users before, so options:
1- keep basket in database (consider the cost and time to store and retrieve information) 2- store my basket in Cookies (I don't know what the implementation is)
I couldn't use session because it is not permanent and clear by closing browser.
My goal is : when the user close the IE for 1 day or 2 days make ability to remember all products that already added to basket.
In addition, my basket is store in hash-table now, for example : {1:4055,2:4588,...} they are ID and product code(keys). they are all save in a hash table.
I am trying to make a program that queries the same tables every few seconds.Is it better to use the same connection to reconnect everytime before the program requeries ?
This would be a simple one for me if I was binding this dynamically. I don't think it's necessary to have a code behind for only 4 or so values. Anyways here is my ddl.
[Code]....
The problem is that when a user selects a value and it postbacks my ddl resets to the first value. How do I prevent this?
I have an access DB created in 2007 and saved in 2003 (.mdb). The tables contain links to a file server on my internal network. I'm trying to import the db into Expression Web 4 and keep the links intact. Currently, I can get the import to work, but the links get stripped out and displayed as plain text.
I am currently working on multiple group sites for the same parent company. All the sites are basically the same, and share the same code base however they have different stylesheets, master pages and config files.
As the number of sites is increasing I am finding it difficult to keep the sites synchronised and propagate bug fixes/changes across them all as each has it's own copy of the code.
Does anyone know of a way I could keep a single master copy of the site and easily propogate changes to each of the other sites.
I was wondering wich's the best way to "keep alive" the InputStream of the FileUpload Control.I would give you one example. Let's assume you have the FileUpload control in one WebForm, and you want process it in the next WebForm (after Response.Redirect).It would be great (unless for the memory) to have something similar to:
Session["PostedFile"] = this.FileUpload.PostedFile.InputStream. Unfortunately, this results in: System.ObjectDisposedException
I have a list of treeview nodes. When I click on a node it redirect me to a page but my treeview nodes go back to my orginal settings for the nodes meaning doesn't keep the node you click on expand when directing to another page. Is there away to keep the states of the collepse nodes?
I am having problems getting my head around this, so my terminalogy might be off. What I am trying to do is have a dropdown list with different groups, and then two listboxes that run queries based on the selection from the dropdownbox. The left listbox shows all items except those which are in the selected group. The right listbox shows only those in the selected group. I also have two buttons - one to move selected items from the left listbox to the right listbox, and another to move items from the right to the left.
My page has a dropdown list for Groups, populated with 2 records - Group A & Group B. Autopostback is set. When I change my selection on the dropdown list, my two listboxes do change
The problem comes in when I select items in the listbox and click on the transfer button. The records do transfer correctly (that is to say the database query executed correctly and data is moved), but the List boxes are not updated. What I want is to have the form refresh, but there is no AutoPostback for the Button object.
I tried inserting a Response.Redirect back to the same page at the end of the button click event. I thought this would allow me to process the sql command, and then refresh the data. This almost works. It does refresh the listboxes, but it also resets the dropdownbox to the first entry. This in turn changes what is displayed in the listboxes. The data is moved correctly though.
So at this point I have my choice. If the dropdown box behaves and does not change, then the listboxes don't update. If the listboxes do update, the dropdown box resets to the default value.
I have an ASP.NET project which is a front-end to a database. In addition to the large tables, the DB contains a few small tables to normalize the larger tables with common values. I have a VB.NET project which loads the smaller tables into memory, using "Shared" (i.e., "static" in C#) member variables, and uses them. I have a call to load the tables in Global.asax - Application_Start. This works for a while. That is, Application_Start runs when I first run my project, loads the cached values, and will correctly keep them in memory for a while.
What I'm seeing (when running my project via Visual Studio 2008 Debugger, hosted locally) is:
A) The Application_Start code will run more than once. Not in a row, but after the user has navigated to some other pages, I'll see (my breakpoint in) another call to initialize the cache, coming form Application_Start. Is it expected?
B) The "Shared" variable that was set to True when the cache was initialized is now False again (which should only happen when the class is first loaded). Similarly, all the data that was chached is no longer present. That is, it looks like VB is unloading all the Shared members. Is this expected?
If these are the expected behaviors, is there a way to do what I want? The code is in a module that is also used by other (non-ASP.NET) projects, and seems to work correctly for them. I'd rather not have to duplicate this functionality for something specific to ASP.NET, but would like to know what my options are.
I have a cascadingdropdown which works fine using a webservice and is populated. I can save the value of this dropdown to the database buy clicking a save button. However when the page reloads, the list is populated again. Is there a way to keep/set the selectedvalue after postback?
I'm developing a web app for which the client wants us to query their data as little as possible. The data will be coming from a Microsoft CRM instance.
So we've agreed that data will only be queried as and when it is needed, therefore if a web user wants to see a list of contacts (for example) that list is fetched into a local DataTable. Then if a new contact is created on the website the new contact is sent to CRM and added to the local DataTable at the same time. Likewise for edits.
If the user then looks at their contacts again the data will just come from the local DataTable.