Hello,
I am creating an application that uses impersonation to log a user into
our domain and then show them the contents of their network share where
they store their files.
I have all the permissions and impersonation working correctly, Now I
have hit a snag on how to get my idea to work..
Right now i have default.aspx, and Directory.cs
inside Directory.cs is the class DirNavigator which has two public
properties: userPath, Current
userPath = full UNC path to their network share
Current = full path to the folder they are browsing after the userPath
I.E.:
userPath = "\\server\dkode "
Current = "Folder1\Folder 2\Folder3
so once they are appended together,
\\server\dkode\ Folder1\Folder2 \Folder3
each time they browse to a different folder, it appends or subtracts
from Current.
The problem arises from the fact that I am storing dirNavigator
instance in the session, each time default.aspx loads, I show the
appropriate folder. When they click the back button, dirNavigator is
not updated and when they click on a different folder, it still thinks
they are one folder deeper then they are.
How else can I store the instance of dirNavigator so that it updates
itself and always has the current path they are working with. maybe a
hidden form variable? the folders can get pretty deep so I don't want
to pass the whole folder path in the querystring...
any suggestions?
Thank you!
DKode 6 1733
You can either place it as a hidden form variable, but I would recommend
placing the CurrentFolder into viewstate for the page. It is basically the
same as a hidden field, except it isn't a hidden field viewable by View
Source.
Also ViewState, IMO, seems easier to code against.
public string Current
{
get
{
//doing it this way will shield your implementation for checking for
null and empty string.
string s = ( string ) ViewState["Current"];
return ( s == null ) ? String.Empty : s;
}
set { ViewState["Current"] = value; }
}
You reference the item anywhere in a page through the property Current.
HTH,
bill
<dk****@gmail.c om> wrote in message
news:11******** **************@ c13g2000cwb.goo glegroups.com.. . Hello,
I am creating an application that uses impersonation to log a user into our domain and then show them the contents of their network share where they store their files.
I have all the permissions and impersonation working correctly, Now I have hit a snag on how to get my idea to work..
Right now i have default.aspx, and Directory.cs
inside Directory.cs is the class DirNavigator which has two public properties: userPath, Current
userPath = full UNC path to their network share Current = full path to the folder they are browsing after the userPath
I.E.: userPath = "\\server\dkode " Current = "Folder1\Folder 2\Folder3
so once they are appended together, \\server\dkode\ Folder1\Folder2 \Folder3
each time they browse to a different folder, it appends or subtracts from Current.
The problem arises from the fact that I am storing dirNavigator instance in the session, each time default.aspx loads, I show the appropriate folder. When they click the back button, dirNavigator is not updated and when they click on a different folder, it still thinks they are one folder deeper then they are.
How else can I store the instance of dirNavigator so that it updates itself and always has the current path they are working with. maybe a hidden form variable? the folders can get pretty deep so I don't want to pass the whole folder path in the querystring... any suggestions?
Thank you!
DKode
thank you,
what does this piece of code here do, i see its some sort of
substitution?
return ( s == null ) ? String.Empty : s;
other than that, would that solve the ie back button problem? or would
i have to format the userpath/current folder?
thanks again
This is shorthand syntax for an if statement. I am not sure if this will
work in vb.
return ( s == null ) ? String.Empty : s;
is equivilent to:
if ( s == null )
return String.Empty;
else
return s;
When the user hits the back button they will be on a page that is displaying
a different path. When the user causes postback on the "backed" page, the
ViewState for the page will have the correct path. I am not sure entirely
what you are asking, but a page that is posted back will have the ViewState
from the page as originally sent. Just try it out and see if that is the
behavior you are expecting and wanting.
bill
"DKode" <dk****@gmail.c om> wrote in message
news:11******** *************@f 14g2000cwb.goog legroups.com... thank you,
what does this piece of code here do, i see its some sort of substitution?
return ( s == null ) ? String.Empty : s;
other than that, would that solve the ie back button problem? or would i have to format the userpath/current folder?
thanks again
ok,
really dumb question,
when I place the ViewState[] code in my dirNavigator class, it says
ViewState namespace does not exist, I added all the refernces as the
aspx page. Can you access ViewState from outside an aspx page or not?
The ViewState is a protected property of the page. If you want to reference
the viewstate outside the page object, you will need to pass a reference
over to it.
I am not sure of your exactly implementation, but you should change this to
what you need it to do.
public class dirNavigator
{
private readonly StateBag ViewState;
publiv dirNavigator( StateBag viewState )
{
ViewState = viewState;
}
}
Now in your page code you will pass the reference to the constructor of the
class.
//in page load or where ever you instantiate it.
dirNavigator navigator = new dirNavigator( this.ViewState );
You will then be able to access the ViewState collection from your outside
class.
HTH,
bill
"DKode" <dk****@gmail.c om> wrote in message
news:11******** **************@ c13g2000cwb.goo glegroups.com.. . ok,
really dumb question,
when I place the ViewState[] code in my dirNavigator class, it says ViewState namespace does not exist, I added all the refernces as the aspx page. Can you access ViewState from outside an aspx page or not?
gotcha,
thanks for the info. i will give it a shot tonight probably.
thanks again!
DKode This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: huzz |
last post by:
I have web application that quaries the Active Directory to get user
details.. everything works fine but someday I'll get
System.Runtime.InteropServices.COMExection and if I restart the client
machine then it works again.
here is one of the method where am calling the AD
public bool UserExist(string UserName)
{
|
by: Andrew |
last post by:
Hey all,
Working on revamping our Intranet here and making use of the LDPA, Active
Directory, Directory Services, etc. that .Net provides. I am still fairly
new on this subject, so the problem I have run into I am not sure how to
fix, and really not sure what is causing it.
Here's what is going on (test server - Windows 2003 Server):
I have a page in a folder (under anonymous authentication in IIS6) that has
a link on it that...
|
by: nick |
last post by:
I have a problem and I've been using a cheezy work around and was
wondering if anyone else out there has a better solution.
The problem:
Let's say I have a web application appA. Locally, I set it up as
C:\domains\appA. Locally, my IIS root points to C:\domains. I don't
point it to C:\domains\appA since if I have an appB under C:\domains I
wouldn't be able to get to it. So to access it via my browser I go to
localhost/appA.
|
by: carla |
last post by:
We have a bunch of articles that visitors to our website can read. They do a
search, and we present a list of matching article links. The files are named
sequentially: art1.htm, art2.htm, art3, htm, and so on. The articles
directory is located benath our web app:
inetpub
wwwroot
webapp
articles
|
by: david |
last post by:
I have met a problem about IIS Virtual directory.
wwwroot directory in C drive and my web application abc.aspx in D drive with
path
d:\myApp\App03\abc.aspx. I have set a virtual directory TestVirtualDir in my
web site with path
d:\myApp
When I use the web browser to get abc.aspx, I use URL:
http://localhost/TestVirtualDir/App03/abc.aspx
| |
by: Javier Martinez |
last post by:
Hi
I have asp application in a machine with a virtual directory referring a
shared directory in another machine
When I try to load any aspx page of my portal I get the following error:
Mensaje de error del analizador: We can't load the type 'JULIAN.Global'.
|
by: IainM |
last post by:
How can I enumerate AD objects (only in a given OU, not sub OUs) using the
DirectoryEntry object?
Let me know of this is the wrong forum for this question.
Thanks,
Iain
|
by: tshad |
last post by:
I have a site www.stf.com and a site www.stfstage.com (where I do all my
testing).
The problem is that www.stfstage.com is only internal and I need to get
access from the outside (without creating a new domain).
I tried to create a Virtual directory inside my stf site so that I would
access it like: www.stf.com/stage/.
I run as www.stfstage.com fine and have for a long time.
|
by: Andy Fish |
last post by:
hi,
I have come across the problem mentioned in this blog
http://blogs.msdn.com/toddca/archive/2005/12/01/499144.aspx
it's basically the fact that in ASP.NET 2.0, the File Change Notification is
uses causes the application to unload every time a directory underneath the
webroot is deleted.
|
by: info.lowyeah |
last post by:
Dear all,
Can anybody help me to solve the captioned problem?
Case:
I need to read a directory, which contains some sub-directories. Some
of them are English name, some of them are Chinese name.
Then my program will add the collection of the directory names in the
Drop Down List box.
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |