XML Files In Web Applications
XML Files In Web Applications
XML Files In Web Applications
XML Files In Web Applications
XML Files In Web Applications
XML Files In Web Applications XML Files In Web Applications XML Files In Web Applications XML Files In Web Applications XML Files In Web Applications XML Files In Web Applications XML Files In Web Applications XML Files In Web Applications
XML Files In Web Applications XML Files In Web Applications
XML Files In Web Applications
Go Back  Xtreme Visual Basic Talk > > > XML Files In Web Applications


Reply
 
Thread Tools Display Modes
  #1  
Old 09-22-2010, 10:10 AM
bradptti bradptti is offline
Regular
 
Join Date: Nov 2002
Posts: 72
Default XML Files In Web Applications


OK, I am new to the whole XML thing and am wanting to really understand it since I think it is my best approach. I am developing a web-based application for my work where the interface displays data from a database into several gridview controls on different pages. That user can then edit the content and then at the end they can save their changes to go back to the DB. What I am wanting is to use XML files to store the info so that the info is available across multiple pages of the program. I am understanding how to store the data from the DB to XML, but I am not really understanding the file location. I was trying to do:

doc.Save(MapPath("Test.xml"))

but it creates this on the server in the physical path associated with the virtual path. However, this will be a problem with multiple users running the program. It cannot create this file at this location for multiple users. So, my question is how do you make it so that this XML file can be uniquely created for each user of the program?

Thanks In Advance,

Brad
Reply With Quote
  #2  
Old 09-22-2010, 11:32 AM
Mkjo99 Mkjo99 is offline
Regular
 
Join Date: May 2009
Posts: 53
Default

Forget XML. The code you are writting is executing on the server, not the client. That's why the files are being created on the server.

If you want to preserve data changes coming from multiple pages and allow the user to save it all at once or undo the changes then you could store it in a temp table in your db.

Another option is to load your data into datatables/datasets and store each one in a session variable which would be available to the entire web app. Changes to the displayed data is commited to the datatables and when the user hits the save button you update the db.
Reply With Quote
  #3  
Old 09-22-2010, 11:52 AM
PrOpHeT's Avatar
PrOpHeTXML Files In Web Applications PrOpHeT is offline
Hopelessly confused...

* Expert *
 
Join Date: Mar 2001
Location: Tyler, Tx.
Posts: 3,055
Default

Server.MapPath("~") will return the current directory, from there you can append sub directories like Server.MapPath("~") & "\Tmp"

I will agree this is not a good way to have to persist data across pages, first the file names would have to be unique so multiple users did not collide, there could potentially be session security issues by other users downloading one another's XML back ends.

Can you give a little more detail on what you are trying to do, there may just be easier ways to do it.
__________________
When you earnestly believe you can compensate for a lack of skill by doubling your efforts, there's no end to what you can't do ;)

For the love of Gold...
Reply With Quote
  #4  
Old 09-22-2010, 12:22 PM
bradptti bradptti is offline
Regular
 
Join Date: Nov 2002
Posts: 72
Default

The user selects the "file" (where file here actually means the main primary key of the database which is a concatenation of letters and numbers that make up a reference number here at my work) they wish to edit. On the first screen, they can view/edit the first section of information. From this screen they can click on a menu option to view/edit other sections of information. When they are finished viewing/editing the other sections, they just click on a "Close" menu and goes back to first main screen. When they are finished editing the information, they can then click on "Save" from the menu on the first main screen. What I want is when they click on "Close" of the other screens that the information gets stored away and then when they click on the "Save" menu it will iterate through the stored info and save it to the database. So I was trying to figure out the best way to store this info throughout the whole usage of the program and then save it to the database when the user clicks "Save".

I was thinking that the XML file would be the way to go since you can store data directly from a table or query in a database and then be able to update the XML file as the user makes changes. I thought that was the whole purpose of the XML file. Is the XML file only for use with a windows application only and not for a web application? I am pretty sure I have seen web sites using XML to store info, but am not sure how to store the info into a unique XML file so that no other users XML file clashes.

Am I wrong that XML is usable for a web app? What is the best solution?

Thanks In Advance,

Brad
Reply With Quote
  #5  
Old 09-22-2010, 12:25 PM
bradptti bradptti is offline
Regular
 
Join Date: Nov 2002
Posts: 72
Default

I guess I should also say that I was trying to find a solution that will work both in VB.NET code behind as well as in Javascript, which is why I was looking into XML.
Reply With Quote
  #6  
Old 09-22-2010, 01:55 PM
Mkjo99 Mkjo99 is offline
Regular
 
Join Date: May 2009
Posts: 53
Default

XML files are basically text file based db's with the schema and data all contained in the same file. They are mainly used for exchanging data with different systems across different networks. Moving data in and out of text files in a web app just to store session data is really a bad way to accomplish this. If you want to take the approach of storing session data in a db-like schema then you should just use temp tables in your db to store the data. When data on a page changes, put it into a table on your db. When the user hits save, move the data to the apps live tables. Lot less hassle than messing with text files.

Like I said before, IMO, the best approach would be to load your datatables from your db when the user first loads the webapp. Store each datatable in a session state variable. Load your grids from these datatables. As the user updates the data, you update your datatables. Since the tables are stored in session variables, they will be available to all your webpages and after postbacks. When the user hits the save button, take the changed rows out of the datatables and update your db.

Good Luck
Reply With Quote
  #7  
Old 09-22-2010, 02:39 PM
bradptti bradptti is offline
Regular
 
Join Date: Nov 2002
Posts: 72
Default

I was just doing some research and lots of sites say that storing a dataset into session variables is very inefficient and will eat up the server memory. So I guess the best approach is to use your concept of having temp tables in the db and write to them. Then once the user clicks "Save" then move the data from temp table to live table.

Thanks for all of your help and clarifying things for me.
Reply With Quote
  #8  
Old 09-22-2010, 03:00 PM
Mkjo99 Mkjo99 is offline
Regular
 
Join Date: May 2009
Posts: 53
Default

Yeah, I guess I should have qualified the session state method. If you are loading huge numbers of rows and you have large numbers of users running off of the same server then session variables may not be the best solution.

I like using session variables when I can just because it is simple and saves all the extra trips to the db. My environment is less than a hundred users, plus I try to streamline my queries so that I am only pulling over the minimum data that is needed at that moment. So I can get away with using session variables and still get very good performance. Under the right circumstances, session variables can be a good solution.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
XML Files In Web Applications
XML Files In Web Applications
XML Files In Web Applications XML Files In Web Applications
XML Files In Web Applications
XML Files In Web Applications
XML Files In Web Applications XML Files In Web Applications XML Files In Web Applications XML Files In Web Applications XML Files In Web Applications XML Files In Web Applications XML Files In Web Applications
XML Files In Web Applications
XML Files In Web Applications
 
XML Files In Web Applications
XML Files In Web Applications
 
-->