I am writing an ASP.NET application that initializes some contextual data based on stuff sent through the Request object. How should I be storing this so that it is only visible to objects dealing with the request?
Essentially I have an HttpModule that looks at the request, and does something based on the incoming data:
public void OnBeginRequest(object sender, EventArgs e){
if((sender as HttpApplication).Request.Url.Host == "something"){
// Store some extra information here
}
}
And then I want to retrieve the data later on in the pipeline, in a view
I have a File Uploader in my ASP.NET application Using C#, we can upload any type like images, documents, pdf etc.
I m storing it in the Filesystem and having only the Name of the File in DB.My doubt is can we store the entire file, images in DB. State me Which is good practice and why we need to use it.
If I store all my user info, upon login, in cache and just have a "my account" page that displays the user info from cache, is that a good practice? I'm wondering if a person changes his email or does any type of database modification then the cached variables will be the wrong ones. If I have to update the cache variables every time something happens to the database, is this even a good practice compared to just querying the data whenever needed?
I'm having a couple basic generics problems. Basically, I'm trying to identify a piece of content by two indexes.
1) I need to store the content in the class, so I need to create a class variable, classTableCellContent, to store it in. Therefore I need to create one, requiring me to constrain the generic type "where ContentType : new()". However, when I attempt to consume this type with a string, e.g. TableCell<string>, it throws a compiler error "The type 'string' must have a public parameterless constructor in order to use it as a parameter blahblahblah..."
2) I need to accept input, so I have an add function. However, when I try to indicate that the third parameter is the same data type, i.e. ContentType, the compiler seems to believe that I'm creating a "new" data type with a poorly chosen name that hides the original data type declared in the class declaration. I'm sure this must be something stupid I'm missing. All I want to do is accept an input variable of the generic type in a function and store it in the class for later use.
Here's the code. I've even highlighted the two lines that seem to be throwing the errors.
We have a large multi tenanted website which requires thousands of lines of web.config to support it. As the system grows we are finding it more and more difficult to manage this configuration file.The system currently in place uses XSLT to generate the config but this solution seems to involve a lot of duplicated code (we have 12 deployment environments).
I am leaning towards putting the configuration data in the db so we can be sure that it's deployed with the application and that our release notes don't require the IT guys messing around with XML
i made an asp page for registration with the following fields name, address etc. i also created database in sql server. how to save these field data in my database.
I have got an ASP.Net website, where the data is brought in from ISeries.The data connection to ISeries is quite slow and the speed is quite important for this website. Because of the slow speed of data retrieval from ISeries, I want to make as less database connections as possible.So, I was thinking about storing tables from the database which rarely changes as static properties in my website. Whenevera user logs in I submit a thread which refreshes the data in the static property. Is this approach correct? If not, what are the problems with this approach and what are the possible alternatives?
Example:-
For list of ports, I submit the below thread when user logs on:-
[Code]....
In class Ports, there are 2 methods -
one for populating the static property PortList, and the other checks if the thread is alive and waits for the thread to complete and retrieve the list of ports, once it is complete. The second method is the one which I use in my application whenever I need the list of ports (populating a dropdown, etc).
I have developed an asp.net application that I developed using visual studio express 2008.
With this application, I have 20 sales items. I can sell 10 of each item each day. Customers can order the items in advance but once an item has more than 10 orders for the day then I can not sell any more of the items for that given day. If a customer tries to order another item after 10 has already been ordered then I must tell them that no further items of that kind are available. So for each day there can be possible 200 orders total (20 items x 10 sales). Customers can order months in advance...
So, my question is what kind of storage device do I use to keep track of this kind of data? Database or application variable or other?
Im in the process of developing a web application, and I wish to store a reasonable amount of data for each user.
This data will be accessed each time the page is refreshed.
The only 2 options that I have come up with is:
* Session Data * Storing the information in a text file with random file names for each person * Database
The first one I do not really want to use as it would bog down the server - the second one is cumbersome
Is there any other options?
If possible i was thinking using the database, but am hesitant because of the amount of times the accessing of the database would need (every refresh for every user)
I dont want to store the information inside the viewstate (i dont know what MS was thinking when they thought of viewstate)
I have written a property globally on page load i am storing setting some value into that property but on button click i am not able to retrieve the data. Is there any alternate way to save the data other than viewstate or sessionstate. Ex:
Partial Class _Default Inherits System.Web.UI.Page Private s As String Public Property Test() As String Get Return s End Get Set(ByVal value As String) s = value End Set End Property Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then s = "Test" End If End Sub Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click s = "Champ" End Sub Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click MsgBox(s.ToString()) End Sub End Class
Is it possible to store gridview session data after each postback. I have a gridview and a checkbox within. Each time a user clicks the checkbox, I like to store the gridview ID in a session. After browsing through various pages, I like this session datato continuously store the information up to 20mins?
How can I continously store the session variable. Say a text box and if I enter 1 click on a hyperlink (where session variable is stored) return back to the page, enter 2 click hyperlink then I should get in the session 12?
I have webpage containing 3 views of multiview control. In the first view there are 3 fields Name Age Surname which will be captured in the textbox for the respective fields.In the second view i have three more fields
sex maritalstatus bloodgroup
which will be entered in the respective textboxes and a submit button to store the data in both the views in the sql server database. I have all the fields in the sql server table which are mentioned in the webpage.I need the complete code for storing the entered data in both the views of the multiview control after hitting the submit button.
I am writing an application in which a remote url web site ( says url1 that is sender) sends xml data to another web site (says url2 that is receiver) by using .NET WebRequest. On the receiver url2 if I use .NET Page.Response and .NET Page.Request to store posted/received xml data into an external text file, then the data is stored. However, if I store the received data into database, I do not see the data is stored into the database.
trouble shoot the codes so I can store such remotely posted data into database on the receiver side url2.
I host both url1 site and url2 site in my computer using IIS like [URL]
1/ Receiver page's codes that store remotely posted xml data into database do not work:
protected void Page_Load(object sender, EventArgs e) { Page.Response.ContentType = "text/xml"; StreamReader reader = new StreamReader(Page.Request.InputStream); String xmlData= reader.ReadToEnd(); ProductNameSapce.ProductCollection.InsertReceivedProduct(xmlData).ToString(); // data is not stored ; the method is tested and works well with hard-coded data reader.Close(); Page.Response.End(); }
2/ The version of the receiver page at url2 that stores into an external text file works:
protected void Page_Load(object sender, EventArgs e) { Page.Response.ContentType = "text/xml"; StreamReader reader = new StreamReader ( Page.Request.InputStream ); String xmlData= reader.ReadToEnd (); StreamWriter s; s= File.CreateText ( Server.MapPath(".")+@""+ Guid.NewGuid () + ".txt" ); s.WriteLine ( xmlData); // data is stored in an external text file s.Close (); reader.Close(); Page.Response.End(); }
how to store common data like an arraylist of Sports Class which will have different variables in it. I want to access that Arraylist from Vaious pages.
I am new in PHP Progamming, but done sufficient amount of Web Programming in .Net.
If I create a DataTable and give each column a type, such as Boolean, String, Int32, when I store it to a ViewState Variable will those types persist?
I'm using the DataTable in conjunction with a GridView that has an add row button. I'd like to store the current state in the DataTable then bind the GridView with the previous state.
I was having trouble at first trying to store objects in the DataTable, but now I'm treating like the SQL table I will eventually write to and it's making much more sense. That's why it has fields like boolean, for checkboxes.
I am using asp.net mvc 2.0 to implement shopping cart application.My situation is , I have a order page, there i am adding the products to the Cart.Below it will show the Cart total.Next i will go to the shopping cart page to delete or editing the items.In this page it will show the same cart total as in the Order page.
But once again if i go back to the Order page to order some more products to the cart,the cart total in the order page is showing 0 amount. This is my Shopping cart controller action method,
public ActionResult ShoppingCart(int eventID) { Event e = eRepository.GetEvent(eventID); var cart = Stalbans.Models.ShoppingCart.GetCart(this.HttpContext);
[Code]....
So once i will go to the shopping cart page from the order page and again coming back to the order page it has to show the same cart total. Actually data is persisted in the cart total but it is not showing .Because if you add one more item its amount will added to the existimng cart total and then shows the current cart total. So for the first time i click back at that it has to show the already existed cart total in the cart total value.
I have this simple project which needs to show location on a google map by pulling data from the DB.I am using asp.net, mysql DB, google map and i found out from some website that i needed to use ajax.
The process is like this
1. I have a event form where i have multiple fields to fill in and it includes a Location/Venue fields which i can enter a location by Name(Not the Co-ordination). I am located in Singapore. So all fields will be stored into the DB.
2. I have a webpage displaying a table of the data from the same DB, and it comes with a embedded Google Map. On the table, the value of the Location column will be Hyperlinked, and when i click it, it will act as a search query in the embedded google map and locate the address without reloading the page again(which i believe i gotta use iframe?)