Chinaunix首页 | 论坛 | 博客
  • 博客访问: 486058
  • 博文数量: 33
  • 博客积分: 4168
  • 博客等级: 上校
  • 技术积分: 675
  • 用 户 组: 普通用户
  • 注册时间: 2006-12-26 20:21
文章分类

全部博文(33)

文章存档

2013年(8)

2012年(2)

2011年(7)

2010年(1)

2009年(4)

2008年(11)

分类:

2008-09-17 20:22:49

Q:
Hi, has someone experiences with my newest issue:
I have to create a direct access to a special point within my application.
Therefore I have to transmit login information and task number as parameter
to my web form application.
My idea was to give it as URL-Parameter like
        http:/myapp/#loginname#task008
Is it possible to get the content of URL within the web form application?
Or is there any other way to bring parameter data to my application.
 
by Anja
A:
Usually, # sign is used for initial positioning (scrolling) to some part of
a webpage (marked by tags).
If you can use a different notation for passing parameters, like
http:/myapp/?loginname=yourname&task=008, you may use the following
variants:
I. To get the whole query string (what's after ? mark):
#if DEFINED PBWEBFORM then
 System.Web.HttpRequest request = System.Web.HttpContext.Current.Request
 string ls_query
 ls_query = request.ServerVariables.Get("QUERY_STRING")
 if ISNULL(ls_query) then ls_query = ""  // Default
#end if
 
II. To get a given key value from the url:
#if DEFINED PBWEBFORM then
 System.Web.HttpRequest request = System.Web.HttpContext.Current.Request
 string ls_loginname, ls_task
 ls_loginname = request.QueryString.Get("LOGINNAME")
 if ISNULL(ls_loginname) then ls_loginname = ""  // Default
 ls_task = request.QueryString.Get("TASK")
 if ISNULL(ls_task) then ls_task = ""  // Default
#end if
 
Note that you are not obliged to call these scripts on application OPEN
event.
 
by Ivaylo
For your case, as you're talking about transmitting login information, isn't
it a potential security issue to expose such an information directly on your
urls? The previous examples which read from the URL require GET method for
calling application.
Perhaps, you can use POST method for calling your web application. By using
POST method you can submit some html form containing input elements with
some names and values. In this case, reading parameters from the posted form
can be implemented in the following way:
#if DEFINED PBWEBFORM then
   System.Web.HttpRequest request = System.Web.HttpContext.Current.Request
   string ls_loginname, ls_task
   if Upper(request.ServerVariables.Get("REQUEST_METHOD")) = "POST" then
      ls_loginname = request.Form.Get("LOGINNAME")
      if ISNULL(ls_loginname) then ls_loginname = ""  // Default
      ls_task = request.Form.Get("TASK")
      if ISNULL(ls_task) then ls_task = ""  // Default
   end if
#end if
 
by Ivaylo

 
 
 
 
阅读(2135) | 评论(2) | 转发(0) |
给主人留下些什么吧!~~

csu82632008-09-24 18:08:57

请参考: http://pbdj.sys-con.com/node/311879 利用.net

chinaunix网友2008-09-21 19:13:21

你好,我现在遇到一个问题,就是我的程序中用到了pbdom,但是如果我发布成web form后,pbdom中的东西几乎就不能用了,请问如何解决这个问题,您有没有好的替代方案? 我的mail : wushenzong@163.com