Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7916797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T14:56:04+00:00 2026-06-03T14:56:04+00:00

I have a default.aspx page like this with the goal of redirecting differently based

  • 0

I have a default.aspx page like this with the goal of redirecting differently based on the host header.

<%
if(System.Web.HttpContext.Current.Request.Url.Host == "xxx.xxx.com")
{
response.redirect ("place/subplace/xxx.aspx")
}
else
{
response.redirect ("place/xxx.aspx")
}
%>

but it is giving me the error “Compiler Error Message: BC30201: Expression expected.”

What am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T14:56:06+00:00Added an answer on June 3, 2026 at 2:56 pm

    In C# expressions are terminated with a semicolon ;

    if (System.Web.HttpContext.Current.Request.Url.Host == "xxx.xxx.com")
    {
        Response.Redirect("place/subplace/xxx.aspx"); <-- here
    } 
    else
    {
        Response.Redirect("place/xxx.aspx"); <-- and here
    }
    

    and C# is case-sensitive. Both Response and Redirect start with a capital letter.

    Edit: Since you now tagged this as VB.Net

    Your code is no valid VB.net code. If it were it should read like the following:

    If System.Web.HttpContext.Current.Request.Url.Host = "xxx.xxx.com" Then
        Response.Redirect("place/subplace/xxx.aspx")
    Else
        Response.Redirect("place/xxx.aspx")
    End If
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page, Default.aspx, with its own code-behind file like this: using System;
I have asp.net page like this: Default.aspx: <%@ Page Title=Home Page Language=C# MasterPageFile=~/Site.master AutoEventWireup=true
I have a page like this: <%@ Page Title= Language=C# MasterPageFile=~/TekContent.master AutoEventWireup=true CodeFile=Default.aspx.cs Inherits=_Default
I have Default.aspx and a seperate code file: public partial class _Default : System.Web.UI.Page
I have an ASPX Page: <%@ Page Language=C# MasterPageFile=~/site.Master AutoEventWireup=true CodeBehind=Default.aspx.cs Inherits=myProject.Presentation.Web.Default src=Default.aspx.cs %>
I am having a default page namely default.aspx in this i will have panel.
So I have something like this: <%If (Request.Url.ToString = default.aspx) Then %> <li><a href=url>Link</a></li>
In my aspx page I have a tr which is set visible=false by default.
In my .aspx page I have; <%@ Page Language=VB AutoEventWireup=false CodeFile=Default.aspx.vb Inherits=_Default AspCompat=True %>
I have an ASP.Net Page, aspx with its default form. I have a Submit

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.