"hash" doce

T

Thom Little

JavaScript has a "document.location.hash" to access the section of a
requesting URL to the right of the # sign. They refer to this as the
"hash".

I call an ASP.NET C# webform from an HTML page. The ASP.NET form then calls
an HTML page. I want to preserve the "hash" in the URL if it is present as
the request passes through the ASP.NET webform.

How can I read/write the "hash" code in the ASP.NET C# webform?
 
S

Steven Cheng[MSFT]

Hi Thom,

Welcome to MSDN newsgroup.
AS for the document.location.hash property you mentioned, based on my
research , we could only access it through the clientside script code. In
fact, the document.location.hash is representing the anchor info of a
document and it it only used by the client browser, so the browser event
doesn't send this parameter to the server. I've also tried capturing the
HTTP request through some trace tools and did found that the "hash"
parameter dosn't occur in the HTTP request's header or body.

Please feel free to let me know if you have any other questions. Thanks,

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 
T

Thom Little

I published a restriction on my new capability.

IMHO this is an ASP.NET bug that should be reported.

In my case I want to "share" the query string with other processes. I want
to tack my parameters into the string and leave all the other parameters
alone. This permits me to grab control and pass information without
disrupting the original message.

If the original URL contains a "hash" my new ASP.NET capability will delete
it. (The technical name for this condition is "doesn't play nicely with
others"'.)
 
S

Steven Cheng[MSFT]

Thanks for your prompt response Thom,

The "hash(#)" url parameter is a bit different from the other params such
as querystring, the standard HTTP url schema dosn't include the "hash"
section, refer to the RFC2616 http 1.1 protocol:

http://www.faqs.org/rfcs/rfc2616.html
===========================
3.2.2 http URL

The "http" scheme is used to locate network resources via the HTTP
protocol. This section defines the scheme-specific syntax and
semantics for http URLs.

http_URL = "http:" "//" host [ ":" port ] [ abs_path [ "?" query ]]
===========================

When we navigate to a page with a url like:

http://servername/webapp/page.xxx?var=xxx#section_name

only the

"http://servername/webapp/page.xxx?var=xxx"

will be sent by the webbrowser(IE, Mozilla,....) in the HTTP request to
the serverside. The hash param (#...) will be used only at clientside in
browser. That's why we can't get it in our asp.net web page's server code.
Also, as I mentioned in the former message, we can use some tools such as
netmon or Trace Utility to capture the HTTP request from client , we can
find that the comming http message dosn't contain the "hash" info. Thus,
the serverside web service have no idea of the "hash" parameter no matter
what active document technique we're using at serverside ( ASP/ASP.NET ,
JSP , PHP.......).

Thanks for your understanding.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,202
Latest member
MikoOslo

Latest Threads

Top