473,398 Members | 2,212 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

browser compatibility issue in safari

i was working in a project with j2ee/jsp and asp format
in a MVC model in Websphere application Developer.

well the code started by prompting user to enter user name and password
and then checks against the active directory and then displays the page.
this is a pretty straight forward thing which run well in mozilla, IE, and Netscape navigator.

But, when checked against the safari in mac, after entering user name and password nothing gets displayed.

when i checked IDE it showed some errors.
As i further checked, i found that the variable for username was blank.

what could have gone wrong?
Sep 21 '07 #1
6 2368
pbmods
5,821 Expert 4TB
Heya, nicetohaveyou. Welcome to TSDN!

I'm going to go ahead and move this thread to the Java forum, where our resident Experts will be better able to help you out.
Sep 21 '07 #2
Heya, nicetohaveyou. Welcome to TSDN!

I'm going to go ahead and move this thread to the Java forum, where our resident Experts will be better able to help you out.



actually the code checks for the active directory
Sep 22 '07 #3
r035198x
13,262 8TB
actually the code checks for the active directory
You'll need to post the code then.
Sep 22 '07 #4
initialy i am using a custom filter.

the code is
Expand|Select|Wrap|Line Numbers
  1. public String getLoginUserName(HttpServletRequest request,HttpServletResponse response) throws GetUserIdException
  2.      {
  3.         String loginName = "";
  4.                 String auth = request.getHeader("Authorization");
  5.         try
  6.         {
  7.         if (auth == null) {
  8.                 response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
  9.                 response.setHeader("WWW-Authenticate", "NTLM");
  10.                 return "";
  11.         }
  12.         else if (auth.startsWith("NTLM ")) {
  13.                  byte[] msg = new sun.misc.BASE64Decoder().decodeBuffer(auth.substring(5));
  14.                 int off = 0, length, offset;
  15.                 String s;
  16.                  if (msg[8] == 1) {
  17.                      off = 18;
  18.                      byte z = 0;
  19.                     byte[] msg1 = {(byte)'N', (byte)'T', (byte)'L', (byte)'M', (byte)'S',
  20.                                     (byte)'S', (byte)'P', z,
  21.                                     (byte)2, z, z, z, z, z, z, z,
  22.                                     (byte)40, z, z, z, (byte)1, (byte)130, z, z,
  23.                                     z, (byte)2, (byte)2, (byte)2, z, z, z, z, //
  24.                                      z, z, z, z, z, z, z, z};
  25.                     //
  26.                      response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
  27.                     response.setHeader("WWW-Authenticate", "NTLM "
  28.                            + new sun.misc.BASE64Encoder().encodeBuffer(msg1).trim());
  29.                     return "";
  30.                 }
  31.                   else if (msg[8] == 3) {
  32.                          off = 30;
  33.                         length = msg[off+17]*256 + msg[off+16];
  34.                         offset = msg[off+19]*256 + msg[off+18];
  35.                         s = new String(msg, offset, length);
  36.                 }
  37.                  else
  38.                     return "";
  39.                             length = msg[off+1]*256 + msg[off];
  40.                 offset = msg[off+3]*256 + msg[off+2];
  41.                 loginName = new String(msg, offset, length);
  42.                 length = msg[off+9]*256 + msg[off+8];
  43.                 offset = msg[off+11]*256 + msg[off+10];
  44.                 loginName = new String(msg, offset, length);
  45.                 }
  46.         }
  47.                 catch(Exception ex)
  48.                 {
  49.                     ANSLogger.logInfo("HeaderFilterDef:getLoginUserName::GetUserIdException occured....");
  50.                     ex.printStackTrace();
  51.                     ANSLogger.logInfo(ex.getMessage());
  52.                     throw new GetUserIdException(AnsErrorCode.GET_USERID_EXCEPTION,"");
  53.                 }
  54.                 return loginName;    }        
  55.  
--------------------------------------------------------------------------------


now, this gives the login name and domain name for all browsers except mac.

So i thought of adding a code which will specifically execute in case it is called from any browser(safari or IE) in a mac.

so i thought of using request.getRemoteUser() but to my misery it was giving null.

when i tried it without custom filter and used a standard ntlmHttpFilter in the DD, it simply worked but as you know. In the filter you need to specify the domain controller.
Now, if the machines from different domains try to access the code, it will not work. However the above code with custom filter works fine for all domains.

So, in order to balance between the two, i though of adding request.getRemoteUser() to the above code which will be executed when the browser is safari or IE for mac.

So, i used String str = request.getHeader("user-agent");
Expand|Select|Wrap|Line Numbers
  1. //"Macintosh"
  2. if(str.indexOf("Macintosh") > -1)
and chip in

request.getRemoteUser();
Dec 26 '08 #5
pbmods
5,821 Expert 4TB
Moved to the cs forum.
Dec 26 '08 #6
Plater
7,872 Expert 4TB
Lets get one thing straight, since this thread is being bounced all over.
You are writing this in java correct? Or is it C#?
It looks like java to me.

If I had to guess why it fails on a MAC computer (and probably on a *nix system) is because NTLM is a microsoft protocol.
Try using one of the standard protocols?

Possibly like this:
Expand|Select|Wrap|Line Numbers
  1. response.setStatus(HttpServletResponse.SC_UNAUTHORIZED); 
  2. response.setHeader("WWW-Authenticate", "Negotiate"); 
  3. response.setHeader("WWW-Authenticate", "NTLM"); 
  4.  
Or however you would get both of them in there
Dec 29 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: liberty | last post by:
Hi, I have looked everywhere to try and solve my problem-- looked at W3C DOM Compatibility charts, read articles, tried debuggers, and still my script is not working. The problem I have is this. ...
7
by: dejavue82 | last post by:
Dear Asp.net users, I have seen some people comment that their asp.net websites render differently with various web browsers. Are they doing somthing wrong? In particilar, 1) I am wondering...
2
by: hangar18 | last post by:
Hi, Is there any standard approach /best practices to achieve browser compatibility. We have a web application which contains both ASP and ASP.NET pages. We would like to achieve complete browser...
15
by: CMM | last post by:
So I'm half way through overseeing a large project in ASP.NET 2.0. My superiors have decided that it would be nice if we ensured the site worked on all the major platforms (as they see it: IE,...
16
by: Edward | last post by:
Hi All, I am having huge problems with a very simple dotnet framework web page (www.gbab.net/ztest3.aspx) , it does NOT render correctly under Apple's Safari. The DIV's do not align amd float as...
27
by: David Golightly | last post by:
This is just a quick poll for all you web devs out there: What browsers do you test on/are concerned about compatibility with? Obviously, you're going to test on current-generation browsers such...
7
by: Tom | last post by:
I have an oo-type javascript program running perfectly on IE 6.0+, FF 1.5+, and Opera 7+ on Windows 98+, Linux (RH 9, FC 6), and Mac OS X. 4. As usual, the Safari browser is not working correctly,...
18
by: Diogenes | last post by:
Several articles I read recently regarding the demise of Netscape Navigator stated that Firefox had managed to get a 16% market share and that IE still has over 80% of the eyeballs. Yet my...
4
by: PianoMan64 | last post by:
Hey Experts, I'm not sure how to get around this, and any help would be most greatfull. I have an issue with having a CSS menu that displays correctly in IE and not correctly in Firefox 3.0.3,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
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,...
0
isladogs
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.