Problem while NOT debugging

N

nottheface

I have a chunk of code I'm writing in a C# code behind. Not sure if
this is the right place to post, but I'm hoping someone has come across
this before...

I have on a page a pair of drop down boxes. Based on the selection
made in one drop down, the second is enabled or disabled.

The code actually works just fine - as long as I put a break point on
the line
if (UserInRole("HR Resolution Admins") == true)
Once it stops, I can hit F5 to continue without stopping again, and it
all works as expected.

If I remove my breakpoints, then the above line is never equal true,
even though I am logged in as the same user. In fact, if I start the
project without the break (where it doesn't work) and add the break in
after I have already loaded the page, it starts to work. Taking the
break back out, of course, means that it stops to work again.

I'm considering simply loading Visual Studio .net on all the users
computers and making them run the application in debug mode - but I
don't think management will go for it...

Really, really frustrating.

Steve.

private void ddlStatus_SelectedIndexChanged(object sender,
System.EventArgs e)
{
try
{
// User changed the selected status, need to repopulate the meeting
date drop down list
// if they selected a committee.
resolutionsWS.Resolutions ws = new resolutionsWS.Resolutions();
ws.Credentials = System.Net.CredentialCache.DefaultCredentials;

// HR Special Case:
// IF user is HR Resolution Admin
if (UserInRole("HR Resolution Admins") == true)
{
// and status is Personnel THEN user can select meeting
if ( Int32.Parse(ddlStatus.SelectedValue) == 16 )
{
//submitted and using an HR template
ddlMeetingDates.Enabled = true;
}
else
{
//NOT an HR template
ddlMeetingDates.Enabled = false;
}
}
else
{
hdnDebugInfo.Text += "Elsed Out";
}
ddlMeetingDates.DataSource =
ws.GetCommitteeMeetingDates(Int32.Parse(ddlStatus.SelectedValue));
ddlMeetingDates.DataTextField = "MeetingDate";
ddlMeetingDates.DataValueField = "MeetingDate";
}
catch (Exception ex)
{
throw ex;
}
finally
{
Page.DataBind();
}
}
 
K

Kevin Spencer

Unless your ASP.Net application runs on a web server that requires a login
(anonymous access disabled), your user will always be the Anonymous Internet
User account on that machine. Which account this is depends on the Operating
System used by the web server.

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

Who is Mighty Abbott? A twin-turret scalawag.
 
N

nottheface

Thanks for the reply, Kevin.

When I say logged on - I mean logged into Sharepoint as a specific user
who is a member of a specific role. This app is actually running in a
Sharepoint page viewer web part. Who is logged in is one of the
factors that determines whether or not they can use the second control.


I just went through this with another programmer (the 4th one besides
me to look at it) and his suggestion was to look deeper into the
crystal ball of impersonation that is taking place in the call to the
UserInRole function. In there I am impersonating the administrator in
order to look at the roles and thus determine if the logged on user is
a member of the pertinent role.

However, any advice on the .net .asp .c# side of things is well and
truely appreciated.

Steve.
 
K

Kevin Spencer

Hi Steve,

You're definitely posting to the WRONG newsgroup for this topic! While yes,
SharePoint is an ASP.Net application, it is so proprietary and low-level
that you can't really understand it in the same way that you would
understand any other ASP.Net application. Here are some newsgroups that
should help:

microsoft.public.sharepoint.general
microsoft.public.sharepoint.development_and_programming
microsoft.public.sharepoint.portalserver
microsoft.public.sharepoint.portalserver.development
microsoft.public.sharepoint.setup_and_administration

--
HTH,

Kevin Spencer
Microsoft MVP
Chicken Salad Surgery

Who is Mighty Abbott? A twin-turret scalawag.
 
N

nottheface

Yeah. My main purpose for posting here was to learn more about why
something might work fine while debugging but failed when running flat
out.

I still don't know why that is the case, but maybe it has something to
do with the sharepoint object model.

or the phase of the moon.

Thanks,
Steve.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top