Ask a Question related to ASP.NET, Design and Development.
-
Carlton858 #1
using System.Net.NetworkCredential class
I am using NUnitASP and I have run into problem "faking" user
credentials. In my ASP.Net/C# application, I have turned off
anonymous access to the web app and I allowing Windows groups to
handle the permissions to the app. Things are working perfectly, i.e.
only user groups that are allowed can log into the app and see what
they are supposed to, when the users enter their credentials through
IE.
It is when I try to enter the credentials programmatically with
NUnitASP that I cannot set the credentials. In most cases, using
System.Net.CredentialCache.DefaultCredentials would be fine and this
works as expected. However, I want to test other roles besides my own
in the app and this is where I need to use the
System.Net.NetworkCredential class.
For some reason I do not understand, I cannot pass a username,
password and domain to this class and have these values detected as
valid credentials. Has anyone used NUnitASP? If so, can you please
share some sample code showing how this works? If you have not used
NUnitASP, but are familiar with the System.Net.NetworkCredential
class, again I could use some coaching on how to use this class.
Thank you in advance for your help.
Carlton
Carlton858 Guest
-
HierarchicalDataSourceControl Class and System.StackOverflowExcept
Hi When running the example code for the FileSystemDataSource which in found in the HierarchicalDataSourceControl Class documentation, I get a... -
Trying to pass NetworkCredential to WebService
Hello, I am running W2k3, Visual Studio 2003, Framework version 1.1.4322. I have one simple asp.net web service and one simple asp.net web app.... -
How to do System.Net.NetworkCredential for ASPX Pages
Hi, I have two created Websites: WSA – With only Integrated Authentication turn on WSB – With Anonymous Access and Integrated Authentication... -
Class 'System.Web.UI.WebControls.DataGridItem' cannot be indexed
I am very new to asp.net. Please help me in resolving the error: DataBinder.Eval: 'System.Data.DataRowView' does not contain a property with the... -
Two Web Services using same NetworkCredential?
Hi, I've been trying to figure this out all day and thought someone here might be able to help. I have a Windows form app that's using windows... -
Eric Marvets #2
Re: using System.Net.NetworkCredential class
Can you post a sample of the NetworkCredential code you are using?
--
Eric Marvets
Principal Consultant
the bang project
<shameless self promotion>
Email [email]sales@bangproject.com[/email] for Information on Our Architecture and
Mentoring Services
</shameless self promotion>
"Carlton858" <cnett858@hotmail.com> wrote in message
news:5e7cb398.0405171542.2cd7a299@posting.google.c om...> I am using NUnitASP and I have run into problem "faking" user
> credentials. In my ASP.Net/C# application, I have turned off
> anonymous access to the web app and I allowing Windows groups to
> handle the permissions to the app. Things are working perfectly, i.e.
> only user groups that are allowed can log into the app and see what
> they are supposed to, when the users enter their credentials through
> IE.
>
> It is when I try to enter the credentials programmatically with
> NUnitASP that I cannot set the credentials. In most cases, using
> System.Net.CredentialCache.DefaultCredentials would be fine and this
> works as expected. However, I want to test other roles besides my own
> in the app and this is where I need to use the
> System.Net.NetworkCredential class.
>
> For some reason I do not understand, I cannot pass a username,
> password and domain to this class and have these values detected as
> valid credentials. Has anyone used NUnitASP? If so, can you please
> share some sample code showing how this works? If you have not used
> NUnitASP, but are familiar with the System.Net.NetworkCredential
> class, again I could use some coaching on how to use this class.
> Thank you in advance for your help.
>
> Carlton
Eric Marvets Guest
-
Carlton Nettleton #3
Re: using System.Net.NetworkCredential class
Here is some sample code.
CredentialCache myCache = new CredentialCache();
myCache.Add(new Uri("http://cnettleton.mydomain.com/"), "Basic",
new NetworkCredential("mydomain\\so_user_test",
"myPassword"));
Browser.Credentials = myCache;
Browser.GetPage("http://cnettleton/blog/web/AddArticle.aspx");
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Carlton Nettleton Guest
-
Carlton858 #4
Re: using System.Net.NetworkCredential class
>
CredentialCache myCache = new CredentialCache();> Can you post a sample of the NetworkCredential code you are using?
>
myCache.Add(new Uri("http://cnettleton.mydomain.com/"), "Basic",
new NetworkCredential("mydomain\\so_user_test", "myPassword"));
Browser.Credentials = myCache;
Browser.GetPage("http://cnettleton/blog/web/AddArticle.aspx");
Carlton
Carlton858 Guest
-
Eric Marvets #5
Re: using System.Net.NetworkCredential class
Pass in the domain, user, and password in seperate fields. The constructor
has an overloaded version to take the domain as a string seperate from the
user as a string.
--
Eric Marvets
Principal Consultant
the bang project
<shameless self promotion>
Email [email]sales@bangproject.com[/email] for Information on Our Architecture and
Mentoring Services
</shameless self promotion>
"Carlton Nettleton" <cnett858@hotmail.com> wrote in message
news:uAyH5AbQEHA.556@TK2MSFTNGP10.phx.gbl...> Here is some sample code.
>
> CredentialCache myCache = new CredentialCache();
>
> myCache.Add(new Uri("http://cnettleton.mydomain.com/"), "Basic",
> new NetworkCredential("mydomain\\so_user_test",
> "myPassword"));
>
> Browser.Credentials = myCache;
> Browser.GetPage("http://cnettleton/blog/web/AddArticle.aspx");
>
>
> *** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
> Don't just participate in USENET...get rewarded for it!
Eric Marvets Guest
-
Carlton Nettleton #6
Re: using System.Net.NetworkCredential class
You mean something like this:
CredentialCache myCache = new CredentialCache();
NetworkCredential myCredential = new NetworkCredential();
myCredential.Domain = "myDomain";
myCredential.UserName = "myDomain\\so_user_test";
myCredential.Password = "myPassword";
myCache.Add(new Uri("http://cnettleton.myDomain.com/"), "Basic",
myCredential);
Browser.Credentials = myCache;
Browser.GetPage(DefaultPage);
If so, that does not work. It returns an HTTP 401/"you are not
authorized to view this page" error.
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Carlton Nettleton Guest
-
adgr2d2 #7
using System.Net.NetworkCredential class
I have use domain and user separated by pipe character ("|"):
It works for me.Code:CredentialCache myCache = new CredentialCache(); myCache.Add(new Uri("http://cnettleton.mydomain.com/"), "Basic", new NetworkCredential("mydomain|so_user_test", "myPassword"));
Junior Member
- Join Date
- Feb 2012
- Location
- United States
- Posts
- 1
-
kolleen.koby #8
Re: using System.Net.NetworkCredential class
In most cases, using
System.Net.CredentialCache.DefaultCredentials would be fine and this
works as expected. However, I want to test other roles besides my own
in the app and this is where I need to use the
System.Net.NetworkCredential class.[URL=http://www.pussy-dreams.com/niches/korean.php]korea pussy[/URL] | [URL=http://www.pussy-dreams.com/]pussy galleries[/URL] | [URL=http://www.pussy-dreams.com/niches/hairy.php]hairy cunts[/URL]
Junior Member
- Join Date
- Mar 2012
- Location
- NY
- Posts
- 10



Reply With Quote

