| | |
Removing prefix XXX\username
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2005
Posts: 14
Reputation:
Solved Threads: 0
I need to remove the prefix(domain name) if exist in front of a username from a session variable.
paramsql.Value = Session("ssNtUser")
say the domain is za
username is macupryk
I would like to remove the za\ so in the session variable I have
macupryk only but the domain name can change. Also there might not even be a domain name with a slash.
Thanks.
paramsql.Value = Session("ssNtUser")
say the domain is za
username is macupryk
I would like to remove the za\ so in the session variable I have
macupryk only but the domain name can change. Also there might not even be a domain name with a slash.
Thanks.
•
•
Join Date: Jul 2005
Posts: 483
Reputation:
Solved Threads: 19
ASP.NET Syntax (Toggle Plain Text)
string testString = Session("ssNtUser").ToString(); int i = testString.IndexOf("\\")+1; if(i > 0) { testString=testString.Substring(i); }
•
•
•
•
Originally Posted by mcupryk
I need to remove the prefix(domain name) if exist in front of a username from a session variable.
paramsql.Value = Session("ssNtUser")
say the domain is za
username is macupryk
I would like to remove the za\ so in the session variable I have
macupryk only but the domain name can change. Also there might not even be a domain name with a slash.
Thanks.
U can use the split method of string object to get the username.
•
•
•
•
string strUser = Session("ssNtUser") as string;
string[] strTemp = strUser.Split('\\');
if(strTemp.length > 0)
strUser = strTemp[strTemp.length - 1];
paramSql.Value = strUser;
Kedar
![]() |
Similar Threads
- create subdomain in server dynamically using php (PHP)
- Copy Folder with %Computername% and %Username% prefix (Visual Basic 4 / 5 / 6)
- Removing ISLE.exe (Windows NT / 2000 / XP)
Other Threads in the ASP.NET Forum
- Previous Thread: Receiving error in Visual Studio.Net when compile with F5
- Next Thread: Session Variable clashing
Views: 2599 | Replies: 3
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 3.5 ajax appliances asp asp.net beginner box browser businesslogiclayer button c# c#gridviewcolumn cac checkbox child class compatible complex confirmationcodegeneration content contenttype control countryselector courier database datagrid datagridview datalist deployment development dgv dialog dropdown dropdownmenu dynamic edit embeddingactivexcontrol feedback fileuploader fill findcontrol flash flv folder form forms gridview gudi homeedition hosting iis image index javascript jquery languages list maps menu mobile mssql nameisnotdeclared novell order problem profile ratings redirect refer registration relationaldatabases response.redirect rows search security select serializesmo.table sessionvariables silverlight smoobjects sql ssl tracking treeview typeof validatedate validation vb.net vista visual-studio visualstudio vs2008 web webarchitecture webdevelopment wizard xml xsl





