check that IIS is configured correctly to host an asp, net application. the app pool should have the correct framework. also check that the app pool account and the anonymous user account have read access to the files.
ASP.NET page not redirecting properly
I am developing asp.net application. In that, i have login page for validating the user and then entering the home page.
This will be working in local and server local machine.
But, when i host in IIS, the home page file not re-directing properly. it show's page not found. but, page will the there in the folder.
what is the problem.
But, in the URL it showing the file name and the page is showing below error.
Internet Information Services
ASP.NET
VB
-
MotoX80 27,621 Reputation points
2023-09-14T13:22:02.9866667+00:00 Press F12 in your browser to launch the developer tools. Select the Network tab and recreate the error. See what page it is attempting to browse.
Or look at your IIS logs for the 404 entry. See what HTTP address cannot be found.
-
Viorel 103.2K Reputation points
2023-09-14T14:11:49.4066667+00:00 If the redirection is done by your code, maybe it can be adjusted.
-
AgaveJoe 685 Reputation points
2023-09-14T14:42:46.77+00:00 what is the problem.
The URL is wrong or the page does not exist.
What is the URL in the browser's address bar? Can you share the redirect code?
-
Gani_tpt 1,401 Reputation points
2023-09-15T07:10:46.9933333+00:00 reply as below
-
Gani_tpt 1,401 Reputation points
2023-09-15T07:22:31.15+00:00 Thanks for the @AgaveJoe and others.
I have used the below URL
- https://avmsvr.avm.avmnet.intranet/Projects120/Login.aspx
- Inside Login.aspx.vb Response.Redirect("Home.aspx")
Anything want to concatenate the complete URL in the "Home.aspx" instead of mentioning Response.Redirect("Home.aspx")
pls. reply.
- https://avmsvr.avm.avmnet.intranet/Projects120/Login.aspx
-
Viorel 103.2K Reputation points
2023-09-15T07:23:14.06+00:00 Check if this works: Response.Redirect("~/Home.aspx").
-
Yurong Dai-MSFT 2,061 Reputation points • Microsoft Vendor
2023-09-15T07:53:06.7033333+00:00 Hi @Gani_tpt,
Could you please provide a minimal reproducible example? -
Gani_tpt 1,401 Reputation points
2023-09-15T08:53:19.47+00:00 Tried below code. but, not working.
DNS Name : https://avmsvr.avm.avmnet.intranet Virtual Path : /Projects120/ Test1.aspx *********** Public Class Test1 Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Response.Redirect("https://avmsvr.avm.avmnet.intranet/Projects120/WebForm1.aspx") 'Or 'Response.Redirect("WebForm1.aspx") End Sub End Class WebForm1.aspx *********** Public Class WebForm1 Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Response.write("WebForm1 Page") Response.End() End Class
-
AgaveJoe 24,396 Reputation points
2023-09-15T09:57:38.6933333+00:00 Anything want to concatenate the complete URL in the "Home.aspx" instead of mentioning Response.Redirect("Home.aspx")
What is the URL in the browser's address bar when when the 404 error is shown?
Is "Projects120" configured as a virtual directory in IIS?
Can you explain how authentication works in your application? Are you using Identity? Did you create a custom authentication/authorization?
-
Gani_tpt 1,401 Reputation points
2023-09-15T11:12:25.8933333+00:00 Hi @AgaveJoe ,
pls. find below comments.
Correct Complete URL : https://avmsvr.avm.avmnet.intranet/Projects120/Apps/
- What is the URL in the browser's address bar when when the 404 error is shown?
URL : https://avmsvr.avm.avmnet.intranet/Projects120/Apps/WebForm1
- Is "Projects120" configured as a virtual directory in IIS?
Yes. "Apps" is Virtual Directory
/Projects120/Apps/ ==> Virtual Path
- Can you explain how authentication works in your application? Are you using Identity? Did you create a custom authentication/authorization?
Authentication : Windows Authentication enabled in IIS Identity and custom authentication not used.
Application folder placed in this folder : D:\SVR290\Projects120\Apps\
-
Gani_tpt 1,401 Reputation points
2023-09-15T13:16:13.05+00:00 pls. reply..
-
AgaveJoe 24,396 Reputation points
2023-09-15T14:17:21.2933333+00:00 The same application configured in some other server. It's working fine without any error. Anything blocking https:// in that server....??
A 404 means the page was not found. I'm not sure what you mean by blocking https or how to force such a condition.
Keep in mind, your first URL is "avmsvr.avm.avmnet.intranet/Projects120/Login.aspx". The URL in the browser is avmsvr.avm.avmnet.intranet/Projects120/Apps/WebForm1.
I assume, as the error clearly states, WebForm1 does not exist in the Apps virtual directory. Or maybe it is the other way around and WebForm1 does not exist in the Projects120 folder.
Authentication : Windows Authentication enabled in IIS
Why is there a login.aspx page if Windows Authentication is enabled in IIS? That makes little sense.
-
SurferOnWww 1,136 Reputation points
2023-09-17T00:53:00.0733333+00:00 I suggest that you use the Fiddler or equivalent tool to see the request and response between the client and server. Difference between IIS Express and IIS might give you a clue to solve the issue.
-
Yurong Dai-MSFT 2,061 Reputation points • Microsoft Vendor
2023-09-19T09:36:18.7333333+00:00 Hi @Gani_tpt,
Based on the URL in your address bar, the virtual path should be/Projects120/Apps/
, not/Projects120/
. You need to ensure that your file structure and application configuration match this virtual path. Please check that the/Projects120/Apps/WebForm1.aspx
file exists in the correct location. If the file does not exist or has an incorrect filename, a 404 error occurs. -
Gani_tpt 1,401 Reputation points
2023-09-19T10:34:07.11+00:00 Thanks for all your support....placed a file in proper place and it's working fine.
Sign in to comment
-
Bruce (SqlWork.com) 44,966 Reputation points
2023-09-14T16:02:05.7533333+00:00 -
Gani_tpt 1,401 Reputation points
2023-09-15T09:20:37.7466667+00:00 Hi Team,
I tried below mentioned code. but, still getting error.
DNS Name : https://avmsvr.avm.avmnet.intranet Virtual Path : /Projects120/ Test1.aspx *********** Public Class Test1 Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Response.Redirect("https://avmsvr.avm.avmnet.intranet/Projects120/WebForm1.aspx") 'Or 'Response.Redirect("WebForm1.aspx") End Sub End Class WebForm1.aspx *********** Public Class WebForm1 Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Response.write("WebForm1 Page") Response.End() End Class
Sign in to comment -