Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   need help with understanding this little bit of code (http://www.velocityreviews.com/forums/t535485-need-help-with-understanding-this-little-bit-of-code.html)

Daniel 09-06-2007 09:11 PM

need help with understanding this little bit of code
 
According to some of the programmers that use to work here and on this code,
it was done in VB and .NET

Can anyone explain what the letter c and the number 1 in this line of code
stand for?



UID = User.Identity.Name.Split("\"c)(1)


--
ASP, SQL2005, DW8 VBScript



Mark Rae [MVP] 09-06-2007 09:22 PM

Re: need help with understanding this little bit of code
 
"Daniel" <dan_c@h.com> wrote in message
news:ehWDwqM8HHA.464@TK2MSFTNGP02.phx.gbl...

> According to some of the programmers that use to work here and on this
> code, it was done in VB and .NET
>
> Can anyone explain what the letter c and the number 1 in this line of code
> stand for?
>
> UID = User.Identity.Name.Split("\"c)(1)


User.Identity.Name will ordinarily return DOMAIN\UserID

The above code is splitting that into an array based on the "\" character,
and then returning the second element in that array (arrays are zero-based
by default)...


--
Mark Rae
ASP.NET MVP
http://www.markrae.net


Daniel 09-06-2007 09:56 PM

Re: need help with understanding this little bit of code
 
so if i understand your reply...

If a user logs in as mydomain\jsmith

Splits it into

mydomain
jsmith

So based on that code.. what SHOULD happen to a user that has a numerical
value in there userid?

jsmith2

Reason im asking, is it seems that if a user has a numerical value in there
ID it ignores that number and defaults to anyone else with a similar ID

So the following 2 people exist here

jsmith
jsmith2

It seems to be ignoring the 2 and defaults to jsmith
So is the letter c in the code looking at just strickly characters? if so
what can we use to take characters and numbers?

--
ASP, SQL2005, DW8 VBScript
"Mark Rae [MVP]" <mark@markNOSPAMrae.net> wrote in message
news:%23Rux5vM8HHA.600@TK2MSFTNGP05.phx.gbl...
> "Daniel" <dan_c@h.com> wrote in message
> news:ehWDwqM8HHA.464@TK2MSFTNGP02.phx.gbl...
>
>> According to some of the programmers that use to work here and on this
>> code, it was done in VB and .NET
>>
>> Can anyone explain what the letter c and the number 1 in this line of
>> code stand for?
>>
>> UID = User.Identity.Name.Split("\"c)(1)

>
> User.Identity.Name will ordinarily return DOMAIN\UserID
>
> The above code is splitting that into an array based on the "\" character,
> and then returning the second element in that array (arrays are zero-based
> by default)...
>
>
> --
> Mark Rae
> ASP.NET MVP
> http://www.markrae.net




=?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?= 09-06-2007 10:30 PM

RE: need help with understanding this little bit of code
 
Daniel,

"a"c in vb.net distinguishes the char type from the string type. Char type
represents any single unicode character (a letter, a digit, + - \ / space,
return, $ % etc.) whilst string is a sequence of many characters (simplifying
string is an array of Char-s).
"\"c represents backslash character. (1) is the second element (because this
is zero-index based array) in the array of strings returned from Split()
function. It shouldn't skip numeric characters. Try

dim result as String() = User.Identity.Name.Split(new Char() { "\"c } )

dim domain as string = result(0)
dim user as string = result(1)

if result.Length > 0 then
domain = result(0)
if result.Length > 1 Then
user = result(1)
end if
end if

HTH
--
Milosz


"Daniel" wrote:

> According to some of the programmers that use to work here and on this code,
> it was done in VB and .NET
>
> Can anyone explain what the letter c and the number 1 in this line of code
> stand for?
>
>
>
> UID = User.Identity.Name.Split("\"c)(1)
>
>
> --
> ASP, SQL2005, DW8 VBScript
>
>
>


Daniel 09-10-2007 06:36 PM

Re: need help with understanding this little bit of code
 
With that said.. would there be any reason why the code would be ignoring
users with numerical values in there userid?

Im just trying to figure out if the code is ignoring the number in the id
and defaulting to the first person that meets thefirst part of the name...

jdoe ( Joe Doe )
jdoe2 ( John Doe )

even though the user names are similar everything is unique

When jdoe logs in.... he gets access to jdoe2 data
--
ASP, SQL2005, DW8 VBScript
"Milosz Skalecki [MCAD]" <mily242@DONTLIKESPAMwp.pl> wrote in message
news:81C30135-D434-4875-9B53-A0ECDC6F6FF1@microsoft.com...
> Daniel,
>
> "a"c in vb.net distinguishes the char type from the string type. Char type
> represents any single unicode character (a letter, a digit, + - \ / space,
> return, $ % etc.) whilst string is a sequence of many characters
> (simplifying
> string is an array of Char-s).
> "\"c represents backslash character. (1) is the second element (because
> this
> is zero-index based array) in the array of strings returned from Split()
> function. It shouldn't skip numeric characters. Try
>
> dim result as String() = User.Identity.Name.Split(new Char() { "\"c } )
>
> dim domain as string = result(0)
> dim user as string = result(1)
>
> if result.Length > 0 then
> domain = result(0)
> if result.Length > 1 Then
> user = result(1)
> end if
> end if
>
> HTH
> --
> Milosz
>
>
> "Daniel" wrote:
>
>> According to some of the programmers that use to work here and on this
>> code,
>> it was done in VB and .NET
>>
>> Can anyone explain what the letter c and the number 1 in this line of
>> code
>> stand for?
>>
>>
>>
>> UID = User.Identity.Name.Split("\"c)(1)
>>
>>
>> --
>> ASP, SQL2005, DW8 VBScript
>>
>>
>>




=?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?= 09-12-2007 10:04 PM

Re: need help with understanding this little bit of code
 
Hi Daniel,

I think everything is ok with the code you posted. I suspect there's a dodgy
logic before/afterwards. Have you debugged the code so you can confirm
numeric character(s) are truncated. Could you please paste a bigger chunk of
code so we could have a look?

Regards
--
Milosz


"Daniel" wrote:

> With that said.. would there be any reason why the code would be ignoring
> users with numerical values in there userid?
>
> Im just trying to figure out if the code is ignoring the number in the id
> and defaulting to the first person that meets thefirst part of the name...
>
> jdoe ( Joe Doe )
> jdoe2 ( John Doe )
>
> even though the user names are similar everything is unique
>
> When jdoe logs in.... he gets access to jdoe2 data
> --
> ASP, SQL2005, DW8 VBScript
> "Milosz Skalecki [MCAD]" <mily242@DONTLIKESPAMwp.pl> wrote in message
> news:81C30135-D434-4875-9B53-A0ECDC6F6FF1@microsoft.com...
> > Daniel,
> >
> > "a"c in vb.net distinguishes the char type from the string type. Char type
> > represents any single unicode character (a letter, a digit, + - \ / space,
> > return, $ % etc.) whilst string is a sequence of many characters
> > (simplifying
> > string is an array of Char-s).
> > "\"c represents backslash character. (1) is the second element (because
> > this
> > is zero-index based array) in the array of strings returned from Split()
> > function. It shouldn't skip numeric characters. Try
> >
> > dim result as String() = User.Identity.Name.Split(new Char() { "\"c } )
> >
> > dim domain as string = result(0)
> > dim user as string = result(1)
> >
> > if result.Length > 0 then
> > domain = result(0)
> > if result.Length > 1 Then
> > user = result(1)
> > end if
> > end if
> >
> > HTH
> > --
> > Milosz
> >
> >
> > "Daniel" wrote:
> >
> >> According to some of the programmers that use to work here and on this
> >> code,
> >> it was done in VB and .NET
> >>
> >> Can anyone explain what the letter c and the number 1 in this line of
> >> code
> >> stand for?
> >>
> >>
> >>
> >> UID = User.Identity.Name.Split("\"c)(1)
> >>
> >>
> >> --
> >> ASP, SQL2005, DW8 VBScript
> >>
> >>
> >>

>
>
>


Daniel 09-12-2007 10:26 PM

Re: need help with understanding this little bit of code
 
Here is more of the code: ( this is bits of the code.... )
Private Sub GetPrefixInfo()

'Put user code to initialize the page here

Dim occAssocInfo As cAssocInfo = New cAssocInfo()

Dim odsPrefixInfo As dsPrefixData = New dsPrefixData()

Dim selAlpha As Char

'Get Store ID, Employee and Contractor Prefixes

odsPrefixInfo = occAssocInfo.GetPrefix()

Session.Clear()

Session("iEmpPrefix") = odsPrefixInfo.usp_GetPrefix(0).emp_prefix

Session("iContrPrefix") = odsPrefixInfo.usp_GetPrefix(0).contr_prefix

Session("sBarCodeDir") = odsPrefixInfo.usp_GetPrefix(0).seq_descr

Session("PageID") = "Main"

Session("iStoreID") = iStoreID

Session("UIDType") = UIDType

--------------------------

Function getStoreNumberFromIP()

Dim sIPAddress As String

Dim iSplitID As Integer

sIPAddress = Request.ServerVariables("REMOTE_ADDR")

iSplitID = CInt(sIPAddress.Split("."c)(1))

'Identify all valid store id

If iSplitID < 2 Or iSplitID > 99 Then

iSplitID = 999

End If

Return iSplitID

End Function

----------------------------------------

'Find the user on the email list

Try

GRSearch.Filter = "(&(objectCategory=user)(mail=" & UID & "*))"

oResults = GRSearch.FindAll()

'Determine if the user is in the group of valid users

For Each oResult In oResults

For iMemCount = 0 To
oResult.GetDirectoryEntry().Properties("memberOf") .Count - 1

strMember = oResult.GetDirectoryEntry().Properties("memberOf") (iMemCount)

iEqlIdx = strMember.IndexOf("=", 1)

iComIdx = strMember.IndexOf(",", 1)

strGroupName = strMember.Substring(iEqlIdx + 1, (iComIdx - iEqlIdx) - 1)

'Check if the Group is a valid user or not

If strGroupName = GRAdminGroup Then

UIDType = "Admin"

bValid = True

End If

If strGroupName = GRUserGroup Then

UIDType = "User"

bValid = True

End If

'Check if there is a Store Group for the user

If Len(strGroupName) >= 7 Then

If UCase(strGroupName.Substring(0, 5)) = "STORE" Then

'Extract StoreID

If IsNumeric(strGroupName.Substring(5, 2)) Then

iStoreID = CInt(strGroupName.Substring(5, 2))

End If

End If

End If

Next

Next

Catch e1 As Exception

Return False

End Try

================================================

This is not in order, but the bits the seem to have to do with the
validating the user...



thanks.


--
ASP, SQL2005, DW8 VBScript
"Milosz Skalecki [MCAD]" <mily242@DONTLIKESPAMwp.pl> wrote in message
news:1D0535C7-A26E-448C-A07B-E41B381BFEAC@microsoft.com...
> Hi Daniel,
>
> I think everything is ok with the code you posted. I suspect there's a
> dodgy
> logic before/afterwards. Have you debugged the code so you can confirm
> numeric character(s) are truncated. Could you please paste a bigger chunk
> of
> code so we could have a look?
>
> Regards
> --
> Milosz
>
>
> "Daniel" wrote:
>
>> With that said.. would there be any reason why the code would be ignoring
>> users with numerical values in there userid?
>>
>> Im just trying to figure out if the code is ignoring the number in the id
>> and defaulting to the first person that meets thefirst part of the
>> name...
>>
>> jdoe ( Joe Doe )
>> jdoe2 ( John Doe )
>>
>> even though the user names are similar everything is unique
>>
>> When jdoe logs in.... he gets access to jdoe2 data
>> --
>> ASP, SQL2005, DW8 VBScript
>> "Milosz Skalecki [MCAD]" <mily242@DONTLIKESPAMwp.pl> wrote in message
>> news:81C30135-D434-4875-9B53-A0ECDC6F6FF1@microsoft.com...
>> > Daniel,
>> >
>> > "a"c in vb.net distinguishes the char type from the string type. Char
>> > type
>> > represents any single unicode character (a letter, a digit, + - \ /
>> > space,
>> > return, $ % etc.) whilst string is a sequence of many characters
>> > (simplifying
>> > string is an array of Char-s).
>> > "\"c represents backslash character. (1) is the second element (because
>> > this
>> > is zero-index based array) in the array of strings returned from
>> > Split()
>> > function. It shouldn't skip numeric characters. Try
>> >
>> > dim result as String() = User.Identity.Name.Split(new Char() { "\"c } )
>> >
>> > dim domain as string = result(0)
>> > dim user as string = result(1)
>> >
>> > if result.Length > 0 then
>> > domain = result(0)
>> > if result.Length > 1 Then
>> > user = result(1)
>> > end if
>> > end if
>> >
>> > HTH
>> > --
>> > Milosz
>> >
>> >
>> > "Daniel" wrote:
>> >
>> >> According to some of the programmers that use to work here and on this
>> >> code,
>> >> it was done in VB and .NET
>> >>
>> >> Can anyone explain what the letter c and the number 1 in this line of
>> >> code
>> >> stand for?
>> >>
>> >>
>> >>
>> >> UID = User.Identity.Name.Split("\"c)(1)
>> >>
>> >>
>> >> --
>> >> ASP, SQL2005, DW8 VBScript
>> >>
>> >>
>> >>

>>
>>
>>




=?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?= 09-13-2007 05:28 PM

Re: need help with understanding this little bit of code
 
Howdy,

what about this line?:

GRSearch.Filter = "(&(objectCategory=user)(mail=" & UID & "*))"

Seems wjen the lgon is john, it will apply the logic for any john* (i.e.
john2) My advice would be to debug the original line
UID = User.Identity.Name.Split("\"c)(1)
to see value of the UID just after the statement has been executed. But my
gut feeling is the line i have just pointed out is the source of your issue.

HTH
--
Milosz


"Daniel" wrote:

> Here is more of the code: ( this is bits of the code.... )
> Private Sub GetPrefixInfo()
>
> 'Put user code to initialize the page here
>
> Dim occAssocInfo As cAssocInfo = New cAssocInfo()
>
> Dim odsPrefixInfo As dsPrefixData = New dsPrefixData()
>
> Dim selAlpha As Char
>
> 'Get Store ID, Employee and Contractor Prefixes
>
> odsPrefixInfo = occAssocInfo.GetPrefix()
>
> Session.Clear()
>
> Session("iEmpPrefix") = odsPrefixInfo.usp_GetPrefix(0).emp_prefix
>
> Session("iContrPrefix") = odsPrefixInfo.usp_GetPrefix(0).contr_prefix
>
> Session("sBarCodeDir") = odsPrefixInfo.usp_GetPrefix(0).seq_descr
>
> Session("PageID") = "Main"
>
> Session("iStoreID") = iStoreID
>
> Session("UIDType") = UIDType
>
> --------------------------
>
> Function getStoreNumberFromIP()
>
> Dim sIPAddress As String
>
> Dim iSplitID As Integer
>
> sIPAddress = Request.ServerVariables("REMOTE_ADDR")
>
> iSplitID = CInt(sIPAddress.Split("."c)(1))
>
> 'Identify all valid store id
>
> If iSplitID < 2 Or iSplitID > 99 Then
>
> iSplitID = 999
>
> End If
>
> Return iSplitID
>
> End Function
>
> ----------------------------------------
>
> 'Find the user on the email list
>
> Try
>
> GRSearch.Filter = "(&(objectCategory=user)(mail=" & UID & "*))"
>
> oResults = GRSearch.FindAll()
>
> 'Determine if the user is in the group of valid users
>
> For Each oResult In oResults
>
> For iMemCount = 0 To
> oResult.GetDirectoryEntry().Properties("memberOf") .Count - 1
>
> strMember = oResult.GetDirectoryEntry().Properties("memberOf") (iMemCount)
>
> iEqlIdx = strMember.IndexOf("=", 1)
>
> iComIdx = strMember.IndexOf(",", 1)
>
> strGroupName = strMember.Substring(iEqlIdx + 1, (iComIdx - iEqlIdx) - 1)
>
> 'Check if the Group is a valid user or not
>
> If strGroupName = GRAdminGroup Then
>
> UIDType = "Admin"
>
> bValid = True
>
> End If
>
> If strGroupName = GRUserGroup Then
>
> UIDType = "User"
>
> bValid = True
>
> End If
>
> 'Check if there is a Store Group for the user
>
> If Len(strGroupName) >= 7 Then
>
> If UCase(strGroupName.Substring(0, 5)) = "STORE" Then
>
> 'Extract StoreID
>
> If IsNumeric(strGroupName.Substring(5, 2)) Then
>
> iStoreID = CInt(strGroupName.Substring(5, 2))
>
> End If
>
> End If
>
> End If
>
> Next
>
> Next
>
> Catch e1 As Exception
>
> Return False
>
> End Try
>
> ================================================
>
> This is not in order, but the bits the seem to have to do with the
> validating the user...
>
>
>
> thanks.
>
>
> --
> ASP, SQL2005, DW8 VBScript
> "Milosz Skalecki [MCAD]" <mily242@DONTLIKESPAMwp.pl> wrote in message
> news:1D0535C7-A26E-448C-A07B-E41B381BFEAC@microsoft.com...
> > Hi Daniel,
> >
> > I think everything is ok with the code you posted. I suspect there's a
> > dodgy
> > logic before/afterwards. Have you debugged the code so you can confirm
> > numeric character(s) are truncated. Could you please paste a bigger chunk
> > of
> > code so we could have a look?
> >
> > Regards
> > --
> > Milosz
> >
> >
> > "Daniel" wrote:
> >
> >> With that said.. would there be any reason why the code would be ignoring
> >> users with numerical values in there userid?
> >>
> >> Im just trying to figure out if the code is ignoring the number in the id
> >> and defaulting to the first person that meets thefirst part of the
> >> name...
> >>
> >> jdoe ( Joe Doe )
> >> jdoe2 ( John Doe )
> >>
> >> even though the user names are similar everything is unique
> >>
> >> When jdoe logs in.... he gets access to jdoe2 data
> >> --
> >> ASP, SQL2005, DW8 VBScript
> >> "Milosz Skalecki [MCAD]" <mily242@DONTLIKESPAMwp.pl> wrote in message
> >> news:81C30135-D434-4875-9B53-A0ECDC6F6FF1@microsoft.com...
> >> > Daniel,
> >> >
> >> > "a"c in vb.net distinguishes the char type from the string type. Char
> >> > type
> >> > represents any single unicode character (a letter, a digit, + - \ /
> >> > space,
> >> > return, $ % etc.) whilst string is a sequence of many characters
> >> > (simplifying
> >> > string is an array of Char-s).
> >> > "\"c represents backslash character. (1) is the second element (because
> >> > this
> >> > is zero-index based array) in the array of strings returned from
> >> > Split()
> >> > function. It shouldn't skip numeric characters. Try
> >> >
> >> > dim result as String() = User.Identity.Name.Split(new Char() { "\"c } )
> >> >
> >> > dim domain as string = result(0)
> >> > dim user as string = result(1)
> >> >
> >> > if result.Length > 0 then
> >> > domain = result(0)
> >> > if result.Length > 1 Then
> >> > user = result(1)
> >> > end if
> >> > end if
> >> >
> >> > HTH
> >> > --
> >> > Milosz
> >> >
> >> >
> >> > "Daniel" wrote:
> >> >
> >> >> According to some of the programmers that use to work here and on this
> >> >> code,
> >> >> it was done in VB and .NET
> >> >>
> >> >> Can anyone explain what the letter c and the number 1 in this line of
> >> >> code
> >> >> stand for?
> >> >>
> >> >>
> >> >>
> >> >> UID = User.Identity.Name.Split("\"c)(1)
> >> >>
> >> >>
> >> >> --
> >> >> ASP, SQL2005, DW8 VBScript
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>

>
>
>


Daniel 09-13-2007 07:16 PM

Re: need help with understanding this little bit of code
 
Thank you for the suggestion, i will continue to pester the old programmers
that are still here to see if they know where the original code is so we can
test on another server...

thanks


--
ASP, SQL2005, DW8 VBScript
"Milosz Skalecki [MCAD]" <mily242@DONTLIKESPAMwp.pl> wrote in message
news:1D593660-D848-43EA-B2A4-3E13930E9030@microsoft.com...
> Howdy,
>
> what about this line?:
>
> GRSearch.Filter = "(&(objectCategory=user)(mail=" & UID & "*))"
>
> Seems wjen the lgon is john, it will apply the logic for any john* (i.e.
> john2) My advice would be to debug the original line
> UID = User.Identity.Name.Split("\"c)(1)
> to see value of the UID just after the statement has been executed. But my
> gut feeling is the line i have just pointed out is the source of your
> issue.
>
> HTH
> --
> Milosz
>
>
> "Daniel" wrote:
>
>> Here is more of the code: ( this is bits of the code.... )
>> Private Sub GetPrefixInfo()
>>
>> 'Put user code to initialize the page here
>>
>> Dim occAssocInfo As cAssocInfo = New cAssocInfo()
>>
>> Dim odsPrefixInfo As dsPrefixData = New dsPrefixData()
>>
>> Dim selAlpha As Char
>>
>> 'Get Store ID, Employee and Contractor Prefixes
>>
>> odsPrefixInfo = occAssocInfo.GetPrefix()
>>
>> Session.Clear()
>>
>> Session("iEmpPrefix") = odsPrefixInfo.usp_GetPrefix(0).emp_prefix
>>
>> Session("iContrPrefix") = odsPrefixInfo.usp_GetPrefix(0).contr_prefix
>>
>> Session("sBarCodeDir") = odsPrefixInfo.usp_GetPrefix(0).seq_descr
>>
>> Session("PageID") = "Main"
>>
>> Session("iStoreID") = iStoreID
>>
>> Session("UIDType") = UIDType
>>
>> --------------------------
>>
>> Function getStoreNumberFromIP()
>>
>> Dim sIPAddress As String
>>
>> Dim iSplitID As Integer
>>
>> sIPAddress = Request.ServerVariables("REMOTE_ADDR")
>>
>> iSplitID = CInt(sIPAddress.Split("."c)(1))
>>
>> 'Identify all valid store id
>>
>> If iSplitID < 2 Or iSplitID > 99 Then
>>
>> iSplitID = 999
>>
>> End If
>>
>> Return iSplitID
>>
>> End Function
>>
>> ----------------------------------------
>>
>> 'Find the user on the email list
>>
>> Try
>>
>> GRSearch.Filter = "(&(objectCategory=user)(mail=" & UID & "*))"
>>
>> oResults = GRSearch.FindAll()
>>
>> 'Determine if the user is in the group of valid users
>>
>> For Each oResult In oResults
>>
>> For iMemCount = 0 To
>> oResult.GetDirectoryEntry().Properties("memberOf") .Count - 1
>>
>> strMember = oResult.GetDirectoryEntry().Properties("memberOf") (iMemCount)
>>
>> iEqlIdx = strMember.IndexOf("=", 1)
>>
>> iComIdx = strMember.IndexOf(",", 1)
>>
>> strGroupName = strMember.Substring(iEqlIdx + 1, (iComIdx - iEqlIdx) - 1)
>>
>> 'Check if the Group is a valid user or not
>>
>> If strGroupName = GRAdminGroup Then
>>
>> UIDType = "Admin"
>>
>> bValid = True
>>
>> End If
>>
>> If strGroupName = GRUserGroup Then
>>
>> UIDType = "User"
>>
>> bValid = True
>>
>> End If
>>
>> 'Check if there is a Store Group for the user
>>
>> If Len(strGroupName) >= 7 Then
>>
>> If UCase(strGroupName.Substring(0, 5)) = "STORE" Then
>>
>> 'Extract StoreID
>>
>> If IsNumeric(strGroupName.Substring(5, 2)) Then
>>
>> iStoreID = CInt(strGroupName.Substring(5, 2))
>>
>> End If
>>
>> End If
>>
>> End If
>>
>> Next
>>
>> Next
>>
>> Catch e1 As Exception
>>
>> Return False
>>
>> End Try
>>
>> ================================================
>>
>> This is not in order, but the bits the seem to have to do with the
>> validating the user...
>>
>>
>>
>> thanks.
>>
>>
>> --
>> ASP, SQL2005, DW8 VBScript
>> "Milosz Skalecki [MCAD]" <mily242@DONTLIKESPAMwp.pl> wrote in message
>> news:1D0535C7-A26E-448C-A07B-E41B381BFEAC@microsoft.com...
>> > Hi Daniel,
>> >
>> > I think everything is ok with the code you posted. I suspect there's a
>> > dodgy
>> > logic before/afterwards. Have you debugged the code so you can confirm
>> > numeric character(s) are truncated. Could you please paste a bigger
>> > chunk
>> > of
>> > code so we could have a look?
>> >
>> > Regards
>> > --
>> > Milosz
>> >
>> >
>> > "Daniel" wrote:
>> >
>> >> With that said.. would there be any reason why the code would be
>> >> ignoring
>> >> users with numerical values in there userid?
>> >>
>> >> Im just trying to figure out if the code is ignoring the number in the
>> >> id
>> >> and defaulting to the first person that meets thefirst part of the
>> >> name...
>> >>
>> >> jdoe ( Joe Doe )
>> >> jdoe2 ( John Doe )
>> >>
>> >> even though the user names are similar everything is unique
>> >>
>> >> When jdoe logs in.... he gets access to jdoe2 data
>> >> --
>> >> ASP, SQL2005, DW8 VBScript
>> >> "Milosz Skalecki [MCAD]" <mily242@DONTLIKESPAMwp.pl> wrote in message
>> >> news:81C30135-D434-4875-9B53-A0ECDC6F6FF1@microsoft.com...
>> >> > Daniel,
>> >> >
>> >> > "a"c in vb.net distinguishes the char type from the string type.
>> >> > Char
>> >> > type
>> >> > represents any single unicode character (a letter, a digit, + - \ /
>> >> > space,
>> >> > return, $ % etc.) whilst string is a sequence of many characters
>> >> > (simplifying
>> >> > string is an array of Char-s).
>> >> > "\"c represents backslash character. (1) is the second element
>> >> > (because
>> >> > this
>> >> > is zero-index based array) in the array of strings returned from
>> >> > Split()
>> >> > function. It shouldn't skip numeric characters. Try
>> >> >
>> >> > dim result as String() = User.Identity.Name.Split(new Char() {
>> >> > "\"c } )
>> >> >
>> >> > dim domain as string = result(0)
>> >> > dim user as string = result(1)
>> >> >
>> >> > if result.Length > 0 then
>> >> > domain = result(0)
>> >> > if result.Length > 1 Then
>> >> > user = result(1)
>> >> > end if
>> >> > end if
>> >> >
>> >> > HTH
>> >> > --
>> >> > Milosz
>> >> >
>> >> >
>> >> > "Daniel" wrote:
>> >> >
>> >> >> According to some of the programmers that use to work here and on
>> >> >> this
>> >> >> code,
>> >> >> it was done in VB and .NET
>> >> >>
>> >> >> Can anyone explain what the letter c and the number 1 in this line
>> >> >> of
>> >> >> code
>> >> >> stand for?
>> >> >>
>> >> >>
>> >> >>
>> >> >> UID = User.Identity.Name.Split("\"c)(1)
>> >> >>
>> >> >>
>> >> >> --
>> >> >> ASP, SQL2005, DW8 VBScript
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>

>>
>>
>>





All times are GMT. The time now is 07:57 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.