Solved

UPLOAD file path in webconfig

Posted on 2011-03-11
4
746 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 500 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

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

717 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