• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 106
  • Last Modified:

work out webrequest properties using browser

I can log into this site using chrome, but not IE.
https://www.connect2nse.com/iislNet/Login.jsp?username=ID&password=PWD&submit=Submit

I have Fiddler on my machine and am using .NET 3.5.  How can I use the broswer or Fiddler to set up my web request in C#?

request = (HttpWebRequest)WebRequest.Create(url.ToString());
request.UserAgent = "Chrome/125.22.48.90";
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.KeepAlive = true;
request.Headers.Add("Keep-Alive: 600");
request.Credentials = CredentialCache.DefaultCredentials;
//ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
//Or SecurityProtocolType.Ssl3
request.CookieContainer = new CookieContainer();
0
AlHal2
Asked:
AlHal2
  • 7
  • 6
1 Solution
 
Bob LearnedCommented:
Do you get an error with IE?
0
 
AlHal2Author Commented:
IE Message: Internet Explorer cannot display the webpage
Chrome is fine.
0
 
Bob LearnedCommented:
If you look at the IE request with Fiddler running, do you get any 404 errors (or other errors)?  It also sounds like you have an authorization issue, but since Chrome is working, I wouldn't know off the top of my head what that would be, since I am sitting over here in the dark.
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
AlHal2Author Commented:
I can't see any errors as you describe.  Should I delete the question?
0
 
Bob LearnedCommented:
Are you able to share the Fiddler log for the request?
0
 
AlHal2Author Commented:
It says that The extension of the uploaded file is not in the list of accepted extensions.
0
 
Bob LearnedCommented:
1) Why would it think that you are trying to upload a file when you are trying to log in?

2) Why are you using this content type?

    request.ContentType = "application/x-www-form-urlencoded";

3) Why are you setting the user agent this way?
   
     request.UserAgent = "Chrome/125.22.48.90";
0
 
AlHal2Author Commented:
Sorry, I got this message when I tried to upload the Fiddler log to Experts Exchange.
Regarding your other questions I inherited this program.  Where can I find out the values that these fields normally have?
0
 
Bob LearnedCommented:
1) You should be able to change the extension to one that is allowed, or paste into a Word document, and upload that.

2) If you want to create a request from the browser, there is the PostMan extension for Chrome:

Postman - REST Client (Packaged App)
https://chrome.google.com/webstore/detail/postman-rest-client-packa/fhbjgbiflinjbdggehcddcbncdddomop?hl=en
0
 
AlHal2Author Commented:
I'm seeing a message no cache, must revalidate.  Does that mean anything?

I'm opening up the SAZ file and it's not coming up in a text editor.  I've not uploaded it straight away as it contains the credentials we use to log into the site.
0
 
Bob LearnedCommented:
"I'm seeing a message no cache, must revalidate"
What is the exact message text that you are seeing (since that doesn't mean anything to me)?

What is a SAZ file?
0
 
AlHal2Author Commented:
I think the problem is at the supplier end and due to my ignorance of Fiddler.  I don't want to waste any more of your time.
0
 
AlHal2Author Commented:
I need to learn Fiddler.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 7
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now