?
Solved

UPLOAD file path in webconfig

Posted on 2011-03-11
4
Medium Priority
?
759 Views
Last Modified: 2012-05-11
I am building a project for a client.  I need to be able to upload files to a directory ... I was thinking about putting the path into the webconfig so that the client could just change the name latter to what works for them when the get the code...

Could somebody tell me how that would be done OR if there would be a better way to do that?
0
Comment
Question by:vbnetcoder
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
mayankagarwal earned 2000 total points
ID: 35114589
For global variable you can use the <app key="varName" value="varValue"> tag in web.config file in your asp.net project. There are some other ways also to declare a global variable. You can also use application or session objects to maintain your data between multiple pages. This is the treditional way to make a variable global, but in asp.net we can also use the web.config setting for global declaration. The important part of using the global var in web.config file is that you can change the values on the fly. Means you dont need to complie your application.

for app setting the syntax is

<appSettings>
<add key="varName" value="varValue" />
<appSettings>

to access the variable

string strVar = System.Configuration.ConfigurationSettings.AppSettings["varName"].

For application variables

'To store a variable:
Application.Lock()
Application("MyVar")="whatever"
Application.Unlock()

'to retrieve the variable:
Dim s as String = Application("MyVar").ToString()
0
 

Author Comment

by:vbnetcoder
ID: 35115539
Is their any way to put path into session automatically when the application starts so that I can just grab it so I can just grab it  from the session when I need it in the application?
0
 
LVL 18

Expert Comment

by:Gary Davis
ID: 35115948
During the startup of the application (Global.asax.cs), I have occasionally iterated through all appSettings and store them in the Application object for easy access. Also, you could create a strongly typed class to hold them too (not quite as generic as using Application).

Gary Davis
0
 

Author Closing Comment

by:vbnetcoder
ID: 35160989
ty
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question