CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting – 3 Months Free!



Zone: > NEWSGROUP > Asp.Net Forum > visual_studio.visual_studio_2005 Tags:
Item Type: NewsGroup Date Entered: 8/21/2007 10:12:33 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 2 Views: 30 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
3 Items, 1 Pages 1 |< << Go >> >|
tomhirt
Asp.Net User
How to Save User ID and apply to whole site?8/21/2007 10:12:33 PM

0/0

Currently, I have on-load code (below) that looks at the users network login id, fetches their database ID and assigns to a session varable. With this, I can now display just the records that apply to the user. However, I need to also apply the same idea to grant access to other pages. So that leaves me with two questions.

1. How can I grab their database ID just one time and assign it to a global session which can be used by mutiple pages. Or is this a job for a cookie?

2. I will be fetching the Group ID for the user as well. How do grant access to pages for certain group ids? Perferably would like to send users with no permissions to an info page which allows them to go back to the defualt page.

The defualt page will be refreshed a couple of times on a normal visit. So is the default page the best place to put the fetch code?

'Get NT Login name

Dim StrUserName = Page.User.Identity.Name.ToString()

StrUserName = StrUserName.Substring(12)

Dim strConn As String = ConfigurationManager.ConnectionStrings("plus_be_restoredConnectionString").ConnectionString

Dim DbConn As New CoreLab.PostgreSql.PgSqlConnection(strConn)

Dim Command As CoreLab.PostgreSql.PgSqlCommand = New CoreLab.PostgreSql.PgSqlCommand()

Command.Connection = DbConn

Command.CommandType = Data.CommandType.Text

Command.CommandText = "SELECT fldpartyindexno FROM plus.tblparties WHERE lower(fldwindowslogon) = " & "'" & LCase(StrUserName) & "'"

DbConn.Open()

Dim dr As PgSqlDataReader = Command.ExecuteReader()

'Session.Add("emp_id", "")

Do While dr.Read()

Session("emp_id") = dr("fldpartyindexno")

Loop

'StrUserName = Command.CommandText

StrUserName = Session("emp_id")

DbConn.Close()

Command.Dispose()

DbConn.Dispose()

XiaoYong Dai –
Asp.Net User
Re: How to Save User ID and apply to whole site?8/23/2007 10:31:09 AM

0/0

tomhirt:

1. How can I grab their database ID just one time and assign it to a global session which can be used by mutiple pages. Or is this a job for a cookie?

2. I will be fetching the Group ID for the user as well. How do grant access to pages for certain group ids? Perferably would like to send users with no permissions to an info page which allows them to go back to the defualt page.

Hi

Dim StrUserName = Page.User.Identity.Name.ToString()

This code will get the name of authenticated user, So you may assign it to a global session after the authentication process complete (for one time).

At the same time, your session state should be available. So it should be later than Application_PreRequestHandlerExecute event (see http://support.microsoft.com/default.aspx?kbid=307985)

What about assign the session in Session_Start event like this?

    Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)

              Session("username") = GetUserID(HttpContext.Current.User.Identity.Name)

    End Sub

For the second question, You may need to create a "basePage" and all pages inherits from "basePage" for additional security across check.

private sub CommonPage_Load(ByVal sender As Object, ByVal e As EventArgs) 
    AccessCheck()
End Sub

For more information, please view this link http://www.codeproject.com/aspnet/AspNetInheritance.asp 

Please correct me if any misunderstanding.

This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.
Best Regards
XiaoYong Dai
Microsoft Online Community Support

Please remember to click ?Mark as Answer? on the post that helps you, and to click ?Unmark as Answer? if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
pbromberg
Asp.Net User
Re: How to Save User ID and apply to whole site?8/23/2007 10:49:25 AM

0/0

Page.User.Identity.Name, if not empty, should be available on every page of your site. So there should be no need to incur the additional overhead of storing something in Session which is already freely available to you.


[C# MVP]
Unblog|WebSite|IttyUrl|BlogMetafinder
3 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
I-mode Developer's Guide Authors: Paul Wallace, Andrea Hoffmann, Daniel Scuka, Zev Blut, Kyle Barrow, Pages: 757, Published: 2002
Administrative Assistant's & Secretary's Handbook Authors: James Stroman, Kevin Wilson, Jennifer Wauson, Pages: 556, Published: 2004
Web Application Design Handbook: Best Practices for Web-based Software Authors: Susan L. Fowler, Victor R. Stanwick, Pages: 658, Published: 2004
Excel 2002 VBA Programmer's Reference: Programmers Reference Authors: Rob Bovey, Stephen Bullen, John Green, Robert Rosenberg, Pages: 1032, Published: 2001
PHP & MySQL Web Development All-in-One Desk Reference For Dummies: All-in-one Desk Reference for Dummies. Authors: Janet Valade, Tricia Ballad, Bill Ballad, Pages: 646, Published: 2007
The Everything Guide to Government Jobs: A Complete Handbook to Hundreds of Lucrative Opportunities Across the Nation Authors: James Mannion, Pages: 306, Published: 2007
ASP.NET 2.0 Website Programming: Problem-design-solution Authors: Marco Bellinaso, Pages: 576, Published: 2006
Professional IBM WebSphere 5.0 Application Server Authors: Tim Francis, Rob High, Eric Herness, Jim Knutson, Kim Rochat, Chris Vignola, Pages: 792, Published: 2002
Handbook of Information Security: Threats, Vulnerabilities, Prevention, Detection, and Management Authors: Hossein Bidgoli, Pages: 3366, Published: 2006
Submit Now: Designing Persuasive Websites Authors: Andrew Chak, Pages: 342, Published: 2003

Web:
Firefox won't offer to save user id and passwords for https site Firefox always offers to save user name and password in http sites but not in secure https sites. As administrator in a school this is a problem when ...
User Guide for Online Application Foreign Exchange Administration ... For new user, who has yet to obtain User ID, he/she can register online ... asked questions under the Apply/Register section. It may save you time and ...
Save User Input In File - Application At this point, click the “Save” button. The system will terminate. Run the system again. The first question will again be the User ID string. ...
Save Barn - Terms of Use If you permit any other Save Barnon(s) or entity to use your User Id and Password, ... The Content of the SAVE BARN website, and the site as a whole, ...
Save Entire Website - Spell check websites and find broken links ... Save Entire Website ... Securely Stores Passwords Reg Keys Website ID ... Website logon information (User ID and Password), User id's and passwords for all ...
Auto Insurance Quote: Car & Motorcycle Insurance - Progressive #1 Auto Insurance Web Site - 2008 Keynote. Hi, welcome to Progressive.com! ... Manage Your Policy and More User ID Password. Save ID ...
Web-based CV and Application - Social Sciences and Humanities ... Sep 12, 2008 ... You can only create/maintain one CV per User ID in our system to .... save your application form (PDF file) on a diskette and print it using ...
Fix Firefox Does Not Save, Store or Remember Password On Some ... Aug 16, 2008 ... To permanently enable user ID and password Auto Complete on all websites and web pages regardless of website setting, go to C:\Program ...
Official Website - Surprise, Arizona Each individual applicant must have a unique user ID and password and email ... Please continue to visit the SOAR site and apply for new jobs as they become ...
Employer ID Numbers (EINs) You can then download, save, and print your confirmation notice. It’s fast, free , and user-friendly! Change of Ownership or Structure ...

Videos:
YES Evolutionists Are Retards, Evolution is Just ASSUMPTIONS check the whole video please to see at the end the link that he gave me to open and read, sigh! More shit assumptions from atheists: here is his ...
XML11: An Abstract Windowing Protocol Google TechTalks June 1, 2006 Arno Puder Arno Puder received his masters and Ph.D. in computer science and is currently working as an ...
A Googly MySQL Cluster Talk Google TechTalks April 28, 2006 Stewart Smith Stewart Smith works for MySQL AB as a software engineer working on MySQL Cluster. He is an ...
Open Source Drug Discovery for Neglected Diseases Google TechTalks April 07, 2006 ABSTRACT Marc works with an initiative that seeks to make biological and genomic data open and available such ...
Charlie Rose - Chambers, Hennessy, Schwartz, Sclavos, Doerr ... Segment 1: A view from Silicon Valley with John Chambers, President & CEO of Cisco Systems, John Hennessy, President of Stanford University ...
Long Beach City Council Meeting Long Beach City Council Meeting
Long Beach City Council Meeting Long Beach City Council Meeting




Search This Site:










xsd to vb

aspnet_merge error

web deployment project multiple web.config

visual studio 2005 and asp.net 1.1 questions.

can't drag an access table onto form

web admin tool in vs.net 2005 in combination with sql server 2005

how to list which methods() are being called

windows xp service pack 2 and vs 2005 problem

server explorer not showing sql server node in vs 2005

inherting from system.web.ui.page

vs deleted files on publish of website

selecting multiple controls/elements

copying project in vs 2005

team system (team test & foundation server) -- is it worth it?

re:the type or namespace name xxxx could not be found

accessing the visual studio api

vs 2005 website start options... not persisted

vs 2005 keeps adding height:xpx css attributes to my tables

starting error

version compare help

codefile necessary for web application?

empty toolbox

maintenance mode - visual studio installation

wishlist

aggregation relation ship in class diagram in vs 2005

super simple question about layout

what should the url look like if remote debugging works fine?

location of web reference proxy class

built-in obejects and pre-defined classes

vs 2005 does not recognize template| starter kit zips it created

  Privacy | Contact Us
All Times Are GMT