Unauthorized Error and Internal Server Error

Hello,

 Can someone help me out with this?  I try to upload a large file from the client side to the server side and when I tested on the localhost, I always have this error "The remote server returned an error: (401) Unauthorized.".  So I checked the virtual directory and uncheck the "Anonymous access" and checked the "Intergated window authentication", but still have the same problem.

Also when I tested to upload from a client side to the server side, I got this error message The remote server returned an error: (500) Internal Server Error."

 Does anyone knows why and how do I fix this?  Thanks

 

0
olaamigos
11/27/2007 5:57:56 PM
asp.net.getting-started 91979 articles. 2 followers. Follow

13 Replies
269 Views

Similar Articles

[PageSpeed] 24

How are you attempting to do this upload?


-Tab Alleman
0
talleman
11/27/2007 8:12:50 PM

Before it uploads any files, it will send the request string to the host to validate the username and password, then I get the HttpWebResponse back, if it is valid, then it will upload to the host, but it returns The remote server returned an error: (401) Unauthorized, I have set the server side web config to unchecked anonymous access, but it still fails.  Any ideas why?

0
olaamigos
11/27/2007 9:26:16 PM

Can you post your code?


-Tab Alleman
0
talleman
11/27/2007 9:31:01 PM

RequestString is like this  http://localhost/UploadService/uploadservice.asmx/Login?uname=test&pword=123

 and It fails to response at this code:  myHttpWebResponse = CType(myHttpWebRequest.GetResponse(), HttpWebResponse)

 

Private Function UploadFile(ByVal filename As String, ByVal username As String, ByVal password As String, ByVal hostname As String) As Boolean

Dim bUser As Boolean

Dim myWebClient As New WebClient()

Dim myHttpWebRequest As HttpWebRequest

Dim myHttpWebResponse As HttpWebResponse

Dim RequestString As String

Dim resStream As Stream

Dim Return_code As Boolean

Try

RequestString = hostname + "/Login?uname=" + username + "&pword=" + password

Call Write_Upload_Trace_record(RequestString)

myHttpWebRequest = CType(WebRequest.Create(RequestString), HttpWebRequest)

myHttpWebResponse = CType(myHttpWebRequest.GetResponse(), HttpWebResponse)

resStream = myHttpWebResponse.GetResponseStream()

Dim count As Long = 0

Dim buf(8192) As Byte

Dim sTemp As String

Dim sb As New StringBuilder()

Do

count = resStream.Read(buf, 0, buf.Length)

If count <> 0 Then

sTemp = Encoding.ASCII.GetString(buf, 0, count)

sb.Append(sTemp)

End If

Loop While count > 0

If sb.ToString().IndexOf("Valid User") <> -1 Then

bUser = True

Call Write_Upload_Trace_record("Valid User.")

Call Write_Upload_Trace_record("Starting Upload: " & hostname & "/UploadFile?" & filename)

Dim responseArray As Byte() = myWebClient.UploadFile(hostname + "/UploadFile?", "POST", filename)

Call Write_Upload_Trace_record("File " + filename + " has been uploaded to server")

Call Sleep(2)

myWebClient.Dispose()

Return_code = True

Else

bUser = False

Call Write_Upload_Trace_record("Upload Failed: " + sb.ToString())

Return_code = False

End If

myHttpWebRequest.Abort()

myHttpWebResponse.Close()

Return (Return_code)

Catch e As System.Exception

Call Write_Upload_Trace_record("Upload Failed: " + e.Message())

Return False

End Try

End Function

0
olaamigos
11/27/2007 9:40:42 PM

What happens when you paste your request string into the address bar of a browser?   Do you get a response?


-Tab Alleman
0
talleman
11/27/2007 10:04:44 PM

I got this error response Request format is unrecognized for URL unexpectedly ending in '/Login'.

0
olaamigos
11/27/2007 10:10:49 PM

Why do you have "/Login" in your Request string?  


-Tab Alleman
0
talleman
11/27/2007 10:28:20 PM

The reason why I use the "Login" in the string because when it hits the server application and go in the "Login" function to check the user name and password, but I can take the "Login" out of the string and it's still fails at The remote server returned an error: (401) Unauthorized

0
olaamigos
11/27/2007 10:48:28 PM

Are you sure that's the way the request should be formed?  It makes it an invalid URL.   Maybe the request should really look something more like:   http://mydomain.com/MyApp.asmx?function=login&UID=abc&password=123

 


-Tab Alleman
0
talleman
11/27/2007 11:03:08 PM

Yes that's the way the request string form, when I test the upload from the client side to the Server, It works fine and it uploads any files under 13megs to the server directory and timeout any file over 13 megs, but when I try to tested from client side to the localhost, I get the 401 Unauthorized Error.  I really don't know why it happens?


0
olaamigos
11/28/2007 2:43:07 AM

i'm afraid I'm out of my depth, then.   I've never called a webservice in this manner before.   Is there some reason you can't add the webservice to your project and simply instantiate it?   What happens if you type this in your browser?

  http://localhost/UploadService/uploadservice.asmx

 

 


-Tab Alleman
0
talleman
11/28/2007 7:13:11 PM

How do you add the webservice in the project?  Is it from Client site or Server side?

0
olaamigos
11/29/2007 4:38:33 PM

olaamigos:

How do you add the webservice in the project?  Is it from Client site or Server side?

 

Hi,

Based on my understanding, you want to consume the web service from your asp.net application. If I have misunderstood you, please feel free to let me know.

If we want to consume the web service, we can browse for Web services and add Web references to your Web site with Add Web Reference dialog box. For more information about adding Web services, see http://msdn2.microsoft.com/en-us/library/8dcbc50t(VS.80).aspx and http://aspalliance.com/979_Working_with_Web_Services_Using_ASPNET.all.


I hope this helps. 

 


Thomas Sun
Microsoft Online Community Support

Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
0
Thomas
11/30/2007 3:12:31 AM
Reply:

Similar Artilces:

Server Error: HTTP Error 500.19
I got the following error while trying to make a test WCF project on VistaServer Error HTTP Error 500.19 - Internal Server ErrorDescription: The requested page cannot be accessed because the related configuration data for the page is invalid. Error Code: 0x80070005 Notification: BeginRequest Module: IIS Web Core Requested URL: http://localhost:80/ProductsService/ProductsService.svc Physical Path: C:\Test\ProductsService\ProductsService\ProductsService.svc Logon User: Not yet determined Logon Method: Not yet determined Handler: Not yet determined Config Error: Cannot read configura...

System.Net.WebException: The remote server returned an error: (500) Internal Server Error.
I have written a web service and tested it and it works fine from the .asmx test page. However, when I attempt to call it with a post I get this error:  The remote server returned an error: (500) Internal Server Error. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Net.WebException: The remote server returned an error: (500) Internal Server Error.Source Error: Line 164: myStream.Close() ...

Web Service Error : The remote server returned an error: (500) Internal Server Error
Hi i am getting an error when trying a simple web service. if i run both the web service and the client .aspx page on the same server it works fine, But when i put it on a different server it doesnt work at all and gives me this error"System.Net.WebException: The remote server returned an error: (500) Internal Server Error. at System.Net.HttpWebRequest.GetResponse() at HttpUtils.HttpPost(String URI, String Parameters) in e:\Websites\C#\Live\CMS\Trunk\App_Code\siteFunctions\HttpUtils.cs:line 35"UserApi.asmx  [WebMethod] public string HelloName(string name) { ...

error error error
These are the 2 new errors i am getting now:   1).  Server Error in '/' Application. Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. Parser Error Message: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.Source Error: Line 53: ...

errors errors errors..
Name: harun Email: harunbjk1903hrnatgmaildotcom Product: Firefox Summary: errors errors errors.. Comments: first of all when i launch firefox (3) i cant enter websites via writing.. for example when I type "google" and then press ctrl and enter, it crashes.. and i take lots of error reports. firefox 2 was better.. see you again , harun Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; tr; rv:1.9) Gecko/2008052906 Firefox/3.0 From URL: http://hendrix.mozilla.org/ ...

Start up Error: HTTP/1.1 500 Internal server Error
When I attempt to create a new project or open an existing one, I recieve the following error.  "The Web server reported the following error when attempting to create or open the Web project located at the following URL: 'http://localhost/PROJECTNAME'.  'HTTP/1.1 500 Internal server Error'. Now I have a fix for this, but it requires me to have to do it everytime I reboot my computer.  It's kind of a lengthy process and I've looked just about everywhere for perm. fixes for this error but have come up empty.  I've had just about enough of d...

Error, Error and more errors
Okay, all I wanted to do was test this app out and it has been a nightmare. 1.) Didn't install the sql database. I had to manually install it. 2.) I get errors when trying to add a picture to an album. "Procedure or function ngUpdatePicture has too many arguments specified" Any ideas? I've gotten more errors than this, but there is no use in bitchin. Are you using the v1.6.1 installer? Also, did you select to install the SQL Server db and give it a valid admin login? What were some of the error messages? Did you have an existing DB from a previous install? ...

Only Firefox Get "Error code 500. Message: Internal Server Error"
I just started having a problem in Firefox 1.5.07, but not Opera or IE, when every I get to a site where where I'm directed to an htpps page, I get this diagnostic: Error code 500. Message: Internal Server Error. I've uninstalled and reinstalled Firefox and have cleared all personal data, cookies, files, directories, etc. I'm stuck! What can I do? Thanks a lot for your help. Trish Trish wrote: > I just started having a problem in Firefox 1.5.07, but not Opera or > IE, when every I get to a site where where I'm directed to an htpps > page, I g...

getting error like
hello  Using Ajax 1.0 RC I’m getting this error:Sys.WebForms.PageRequestManagerServerErrorException Error: an unknown error occurred while processing the request on the server. the status code return from the server was 403I have one update panel in which i have gridview control. i have sorting true in gridviewwhen i click on header for sorting and wait for the result. it display updateprogress and working fine as expected.but if i click for sorting on header continueously without stoping after 10 or 12 click it gives me above error. I am struckup heremy code is like this:<asp:Update...

The remote server returned an error: (500) Internal Server Error
Hi  String strUrl = "http://catalogues.cataloguecentral.com.au/global/search/search.aspx?";              // Create a request using a URL that can receive a post.         WebRequest request = WebRequest.Create(strUrl);        // Set the Method property of the request to POST.        request.Method = "POST";        // Create POST data and convert it to a byte array. &...

The remote server returned an error: (500) Internal Server Error.
 System.Net.WebException: The remote server returned an error: (500) Internal Server Error.     i implemented the search functionality in the website searchdotnet some application i got ,i inegrated it ,it works fine localhost but on server i created some problemMark As Answer If my reply helped you. It means that an exception occured , you can specify in the web.config to show the exact exception to remote hosts.what is the <customErrors> configuration in your web.config ?   J.W.Please click "Mark as Answer" on this post if it helps you...

The remote server returned an error: (500) Internal Server Error.
When I remote access in website by application on window to extract data I have error : The remote server returned an error: (500) Internal Server Error. This is my code : Dim PostData As String = _ "__VIEWSTATE=" & tmpvs & _ "&txtUserName=" & UserID & _ "&txtPassword=" & PWord & _ "&chkPersistant=1" & _ "&btnSignIn=SignIn" '& _ Dim Data() As Byte = encoding.GetBytes(PostData) Dim LoginReq As Net.HttpWebRequest = Net.WebRequest.Create(loginURL) With LoginReq .KeepAlive = Fals...

remote server returned an error: (500) Internal Server Error.
Hi Frnds, I have Using HTTP Post Method ,Already create Webconfig fine(  <webServices>      <protocols>        <add name="HttpGet"/>        <add name="HttpPost"/>      </protocols>    </webServices> )But i got  remote server returned an error: (500) Internal Server Error. i am not using SOAP.. public void Post()        {      ...

The remote server returned an error: (500) Internal Server Error
I have a VB.Net application where I am posting to an HTTP server that has a classic asp page and I am getting the following exception (it's throwing the exception on line 13).  Does anyone know how to troubleshoot this?  thanks  : <EXCEPTION> The remote server returned an error: (500) Internal Server Error </EXCEPTION> 1                            PostData = "externalID=" ID2 Dim strPath As ...

Web resources about - Unauthorized Error and Internal Server Error - asp.net.getting-started

A Very Merry Unauthorized Children's Scientology Pageant - Wikipedia, the free encyclopedia
... , Atlanta 2007 – Philadelphia , Atlanta, Washington, D.C. 2008 – Syracuse , Fort Worth , Cincinnati , Chicago , Phoenix A Very Merry Unauthorized ...

ALERT: 600K Unauthorized Facebook Log-Ins Daily
Happy Halloween: A Facebook account gets compromised once every 140 milliseconds.

Detecting unauthorized cross-app resource access on OS X
Last week, Luyi Xing, a Ph.D. student from Indiana University Bloomington and his colleagues released a research paper on several vulnerabilities ...

New Security Tools Prevent and Alert Users to Unauthorized Logins
New Facebook security systems focused on preventing unauthorized logins are now active in the Account Settings -> Account Security panel. Outlined ...

Twitter Blog: Unauthorized Access: An Update
Twitter Blog Unauthorized Access: An Update on Security 811282302648909752 Thursday, April 30, 2009 This week, unauthorized access to Twitter ...

Some authenticated requests result in spurious 401 Unauthorized errors that should be HTTP 500-series ...
A number of authenticated requests to the API that would normally result in a 500-series error condition are currently throwing 401 errors with ...

All sizes - Commerce Committee Hearing on Unauthorized Mystery Telephone Charges - Flickr - Photo Sharing ...
Flickr is almost certainly the best online photo management and sharing application in the world. Show off your favorite photos and videos to ...

The Unauthorized Saved by the Bell Story - Trailer - YouTube
Check out the first trailer for Lifetime's look at what happened behind-the-scenes on Saved by the Bell.

Brian Mulroney : The Unauthorized Chapter : the fifth estate : CBC News
CBC's the fifth estate is Canada's premiere investigative journalism series.

Trudeau Suited Up In Unauthorized Menswear Ad (PHOTO)
After trying Jim Flaherty and Stephen Harper on for size, clothing retailer Harry Rosen is now turning its eye to a new, slightly younger model ...

Resources last updated: 12/6/2015 3:05:23 PM