Oumie
Oumie

Reputation: 49

How do I redirect to an anchor tag on my aspx page

I tried Response.Redirect("page.aspx#here") but it did not work.

This is the code in my aspx file: <a name="here"></a> Do I have to redirect to it differently?

Upvotes: 1

Views: 7644

Answers (2)

San
San

Reputation: 61

The accepted answer here is incorrect.

I am able to make this work in C# by doing the following:

Response.Redirect("page.aspx" + "#here", false);

Upvotes: 3

timbck2
timbck2

Reputation: 1066

You can't redirect to an anchor from server-side code, because the anchor is entirely a client-side concept. You'll have to use Javascript for this. See Retrieving Anchor Link In URL for ASP.Net.

Upvotes: -1

Related Questions