Click here to Skip to main content
15,299,443 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
In my web form want to check textBox1 input text for the URL and I want to show a message 403 Forbidden
but I am unsure about what the user needs to type in and what I need to check for in order to display such a message to the user.

What should I do at the space of "?????"

And Is there anything that can show error codes of a URL visited automatically without having to create a message box?

What I have tried:

C#
if (textBox1.Text == ????? )
                {
                    string message2 = "Status Code";
                    string caption2 = "403 Forbidden";
                    MessageBoxButtons buttons2 = MessageBoxButtons.OK;
                    DialogResult result2;
                    result2 = MessageBox.Show(message2, caption2, buttons2);
                    
                }
Posted
Updated 5-Oct-21 11:09am
v2
Comments
Pete O'Hanlon 5-Oct-21 15:11pm
   
Are you trying to show the status result of a request here?
candijen 5-Oct-21 16:49pm
   
Yes
BillWoodruff 5-Oct-21 15:59pm
   
please do not repost
Dave Kreskowiak 5-Oct-21 16:49pm
   
"happens automatically" only applies to what the user sees when they use your app. For you, the person writing the code, there is no such thing as "happens automatically". YOU have to write the code to give the user the illusion of "automatic".
candijen 5-Oct-21 16:51pm
   
I meant like an existing header file or a method or something that already exists to show status codes from websites visited
Dave Kreskowiak 5-Oct-21 16:53pm
   
No, not for something so specific. Libraries and headers like you're looking for are more general in their functionality and usually do not include any UI interface to make them usable by more types of applications.
candijen 5-Oct-21 17:10pm
   
Alright then
PIEBALDconsult 5-Oct-21 17:10pm
   
Just try what they enter and show them the actual error.
Please stop trying to make things more difficult for yourself.

Embrace the try/catch .

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900