Storing Contextual Data During A Request?

Oct 2, 2010

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

<%: somehowGetRequestSpecificData.MyProperty %>

How and where should I be storing that stuff?

View 1 Replies


Similar Messages:

Storing A Uploaded File In DB Or Storing It In Filesystem?

May 11, 2010

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.

Either file System Storage or SQL DB Storage.

View 4 Replies

Yield Keyword Is Statement Keyword Or Contextual Keyword?

Mar 15, 2011

Is yield keyword is Statement keyword or Contextual Keyword?

Because in MSDN yield keyword is mentioned in both type of Keywords so i'm little bit confused in this.

View 2 Replies

Forms Data Controls :: Retrieving Data From A Web Serivce And Storing The Data Into A Dataset?

Aug 27, 2010

I am retrieving data from a web serivce and storing the data into a dataset.

I'm then populating a gridview with the data from the dataset.

Before each row of data is displayed on the website, I need to check and make sure the user has proper permissions to view that data.

Can this be done with a gridview(or any other .NET data control)?

Or would I need to loop through the data manually, and then write each row out manually?

View 3 Replies

C# - Storing JSON Data In Db?

Jan 3, 2011

I'm trying to store data from fb wall into database.

My *.cs code

public ActionResult GetWall()
{
JSONObject wallData = helper.Get("/me/feed");
if (wallData != null)
{
var data = wallData.Dictionary["data"];
List<JSONObject> wallPosts = data.Array.ToList<JSONObject>();
ViewData["Wall"] = wallPosts;
}
return View("Index");
}

Which gets posts from fb wall. And then I have an *.aspx file, which "breaks" my wallposts into pieces (objects) or whatever you like to call them.

foreach (Facebook.JSONObject wallItem in wallPosts)
{
string wallItemType = wallItem.Dictionary["type"].String;
//AND SO ON...

What i'm trying to say is that I can access to elements inside fb JSON.

Is there a way i can access to the JSON elements inside *.cs file. Or is there a way I can store elements inside the *.aspx file to db?

View 2 Replies

C# - Storing User Data In Cache Vs Querying Data Everytime?

Feb 1, 2011

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?

View 3 Replies

Storing Data In A Generic Field?

Aug 24, 2010

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.

Code:

[code]....

View 11 Replies

C# - Storing Complex Data In A List?

Sep 27, 2010

I'm working with a product called SiteFinity.I have a class which looks like so:

public class Categories
{
public IContent oContent {get; set;}

[code]...

View 2 Replies

Storing Configuration Data In .NET Than The Web/machine Config?

Jun 24, 2010

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

What are better solutions we could use?

View 3 Replies

SQL Server :: Storing Form Data In Database?

Nov 29, 2010

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.

View 2 Replies

Storing Data From Database In Static Property?

Mar 25, 2011

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).

[Code]....

View 1 Replies

Storing Large Arrays Of Persistent Data?

Oct 16, 2010

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?

View 3 Replies

Storing Large Amounts Of Session Data?

Feb 16, 2010

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)

View 2 Replies

State Management :: Storing Data Into Property?

Aug 28, 2010

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

View 11 Replies

Web Forms :: Storing Session Data Continuously?

Oct 20, 2010

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?

View 6 Replies

Forms Data Controls :: Need The Complete Code For Storing The Entered Data In Both The Views Of The Multiview Control After Hitting The Submit Button?

Feb 3, 2010

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.

View 1 Replies

Web Forms :: Storing Remotely Posted Data To Database?

Oct 29, 2010

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();
}

View 10 Replies

Forms Data Controls :: Storing Datetime Into The Database?

Jan 27, 2010

I want to store Date as well as time in a label. The code that i am writing is Label1.Text = Datetime.Now.ToString();

I want to save this value in to the database. This is what i am writing

com.Parameters.Add ("@Dt ", SqlDbType.datetime).Value = label1.Text; // this is the problem.

View 6 Replies

Storing Large Models Common Data Between Different PHP Pages?

Jan 19, 2011

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.

View 1 Replies

Forms Data Controls :: Storing A DataTable In ViewState?

Oct 7, 2010

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.

View 1 Replies

Storing Data For A Particular Time In Mvc 2.0 Using Session State Concept?

Nov 23, 2010

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.

View 1 Replies

Security :: Best Practice For Storing Users Data In Signup Form?

May 21, 2010

Just wanted to know what is the best pratice for storing new fields data when an user sign up ?

Also...

1- Is there a way to make the login controls use the same database than my website database?

2- It is okay to use the Membership and Role API to manager users from an user interface (without the ASP.NET Web configuration tool) ?

View 9 Replies

DataSource Controls :: Storing And Pulling Data In DB To Get Google Map Location

Jul 22, 2010

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?)

View 3 Replies

Forms Data Controls :: Storing Eval Value In A Variable Or IF Statement?

Jul 8, 2010

How do I store an Eval in a variable or use the value of the Eval in an if statement?

View 5 Replies

Databases :: How To Connect With Excel Workbook 2003 For Storing Data

Apr 22, 2010

How to connect with excel workbook 2003 for storing data similar to database. I am using c#.net.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved