Good day, not sure what to do.
I have an ascx page with the code displaying the user logged in, i created an iframe src displaying a report but i want to add the logged in id as parameter but can't determine the code value.
ascx page code -
<%@ Control Language="c#" AutoEventWireup="True" Codebehind="Header.ascx.cs" Inherits="FlowCentric.Net.Navigator.Header" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
-
<tr>
-
<td><asp:Label id="lblLogin" runat="server">Welcome</asp:Label></td>
-
</tr>
-
the iframe report i add & add the user parameter to the label's lblLogon value. -
<IFRAME id="frame1" src="http://biweb/reportserver?&User=lblLogin"</IFRAME>
-
Please Assist, totally lost
34 7975
Get rid of the "&"....it should be like: - <IFRAME id="frame1" src="http://biweb/reportserver?User=lblLogin"</IFRAME>
Another problem you're having is that you aren't actually passing the innerHtml of the Label...
I would recommend using a Session variable instead of passing it via the URL because it's going to be complicated....it's going to require using JavaScript to retrieve the innerHtml of the <span> element (Labels are rendered as <span> elements) to retrieve the login name. Then you'll have to use JavaScript to set the src of the iFrame element.
It's doable but using Session variables is a lot easier and cleaner.
-Frinny
Thank You vey much - tried a few things.
But i will try & and get the code for asp to determine the windows user & pass as a parameter for the report.
I don't think you understood.
It's more than just removing the "&".....
If you're going to pass a value using the URL you need to retrieve the value Client Side using JavaScript and then set the src of the iFrame using JavaScript.
Good day, This is linked to my previous post.
I want to display the Windows user logged on to the PC (domain\userid) and add to the report URL.
I have searched: -
<% Response.Write(Request.ServerVariables("AUTH_user")) %>
-
Now i want to display & add to url: -
<%@ Control Language="c#" AutoEventWireup="True" Codebehind="Header.ascx.cs" Inherits="FlowCentric.Net.Navigator.Header" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
-
<table><tr>
-
<td><asp:Label id="lblLogin" runat="server">We</asp:Label></td>
-
</tr></table>
-
-
<IFRAME id="frame1" src="http://biweb/reportserver?&User= <% Request.ServerVariables("AUTH_user") %>"></IFRAME>
-
-
-
<% Response.Write(Request.ServerVariables("LOGon_user")) %> <!-- this does not work
-
Please Assist!
I've merged your questions together.
Is "http://biweb/reportserver" in the same web application as the other page?
In that case your user's information should already be available in the ReportServer.aspx page.
-frinny
Thank You for the help, the reports are from the BiReportServer
where would i find & extract the information from the reportserver.aspx.
I need to pass the loged in user id to the report parameter.
Please Assist with detail code.
Are both pages part of the same web application??
If so, and you're using Windows Authentication, then you should be able to access the user information using the HttpContext.User property in both pages.
Once a user has logged in a Principal Object is created to represent the user. This Principal Object is recreated every time the user accesses a page in the web application. It's created before your code is accessed so that ASP.NET can determine whether or not the user has permissions to access your code. This Principal Object (which represents your user) is stored in the HttpContext.User property which is available to you through out your web application (in any page).
This contains the User's ID along with other user information.
Unfortnuately they are different servers.
Well you need to append the ID of the user stored in the Label (the <span> element representing the Label) to the src (URL) of the iFrame.
To do this you're going to have to use JavaScript.
You could do something like: -
<script type="text/javascript">
-
function setIFrameSource()
-
{
-
var labelElement = document.getElementById('<%=Request.ServerVariables("AUTH_user")');
-
var newUrl = "http://biweb/reportserver?UserID=" + labelElement.innerHTML;
-
-
var iFrameElement = document.getElementById("frame1");
-
iFrameElement.src = newUrl;
-
}
-
</script>
-
You'd call it during the <body> element's onload event: -
<body onload="setFrameSource">
Please note that spaces will mess up your URL...this means that if your user name has a space you need to remove them and replace it with %20.
Also please note that you have to grab the UserID value from the URL. The easiest way to do this is using Request.Params("UserID"). Always validate this information.
Hi,
It does not like the line
var labelElement = document.getElementById('<%=Request.ServerVariable s("AUTH_user")');
no error message, only incorrect syntax
regards
Hehe, well of course it's incorrect...the word processor here on bytes doesn't automatically close tags like Visual Studio does
Close the "<%= " with "%>".
Like this: -
<script type="text/javascript">
-
function setIFrameSource()
-
{
-
var labelElement = document.getElementById('<%=Request.ServerVariables("AUTH_user") %>');
-
var newUrl = "http://biweb/reportserver?UserID=" + labelElement.innerHTML;
-
-
var iFrameElement = document.getElementById("frame1");
-
iFrameElement.src = newUrl;
-
}
-
</script>
-
My syntax isn't always going to be 100% because I'm just writing quick examples of code...you're going to have to check it and even correct it sometimes to make sure it's working ;)
But the above code is incorrect anyways (because you don't have a Label with the ID that is UserID...instead it should be Label.ClientID). You don't actually need to grab the user ID from the label...you can just simply grab it from the server.
Change it to: -
<script type="text/javascript">
-
function setIFrameSource()
-
{
-
-
var newUrl = "http://biweb/reportserver?UserID=" + "<%=Request.ServerVariables("AUTH_user") %>";
-
-
var iFrameElement = document.getElementById("frame1");
-
iFrameElement.src = newUrl;
-
}
-
</script>
-
Please note that the ASP code "<%=" is the same as having "<% Response.Write() %>"...it's just the short hand version.
Thank You i really appreciate your help & am very gratefull.
Unfortunately still struggling:
It still complains about the 1st line in the javascript : -
<%@ Control Language="c#" AutoEventWireup="True" Codebehind="Header.ascx.cs" Inherits="FlowCentric.Net.Navigator.Header" TargetSchema="http://schemas.microsoft.com/intellisense/ie5"%>
-
-
-
<script type="text/javascript">
-
function setIFrameSource()
-
{
-
-
var newUrl = "http://biweb/reportserver?&User=" + <% Response.Write(Request.ServerVariables("AUTH_user")) %>;
-
-
var iFrameElement = document.getElementById("frame1");
-
iFrameElement.src = newUrl;
-
}
-
</script>
-
-
<body onload="setFrameSource">
-
-
<table><tr>
-
<td><asp:Label id="lblLogin" runat="server">Wel</asp:Label></td>
-
</tr></table>
-
</body>
-
-
Please Assist, my only hope - i dont know the code at all & only know the reports.
Regards
Why do you have an "&" in there?
Also, you need quotes around:
<% Response.Write(Request.ServerVariables("AUTH_user" )) %>
That is going to write text into the place where the Response.Write line is.
You need to specify that this text should be treated as a literal (a String) by putting quotes around it:
"<% Response.Write(Request.ServerVariables("AUTH_user" )) %>";
Hi, this is not the complete link to the report, & identifes the pass of a variable
User is the report parameter name, the "ismail" is the id i'm trying to retreive from the aspx page.
comple link -
http://biweb/reportserver?http%3a%2f%2fsrv08-za143%2fworkspace%2fdepartments%2fIT%2fReportsTest%2fR-MFS014+UserDetails.rdl&rs:Command=Render&User=ismail"
-
Please post error messages if you see them.
-
Line 8: var newUrl = "http://biweb/reportserver?http%3a%2f%2fsrv08-za143%2fworkspace%2fdepartments%2fIT%2fReportsTest%2fR-MFS014+UserDetails.rdl&rs:Command=Render&rc:Toolbar=false&User=" + <% Response.Write(Request.ServerVariables("AUTH_user")) %>;
-
-
error: c:\Inetpub\wwwroot\fcParmalatTest\Header.ascx(8,24 2): error CS1002: ; expected
Please add quotes around the ASP Response.Write() method... use this: - var newUrl = "http://biweb/reportserver?http%3a%2f%2fsrv08-za143%2fworkspace%2fdepartments%2fIT%2fReportsTest%2fR-MFS014+UserDetails.rdl&rs:Command=Render&rc:Toolbar=false&User=" + "<% Response.Write(Request.ServerVariables("AUTH_user")) %>";
No luck, i tried ithout the " + " as well
I tried -
var newUrl = "http://biweb/reportserver?http%3a%2f%2fsrv08-za143%2fworkspace%2fdepartments%2fIT%2fReportsTest%2fR-MFS014+UserDetails.rdl&rs:Command=Render&rc:Toolbar=false&User=" + "<%=Request.ServerVariables("AUTH_user")%>";
-
and get the following error:
error CS1955: Non-invocable member 'System.Web.HttpRequest.ServerVariables' cannot be used like a method.
Please Assist, Regards
Oh.
Are you working in C#?
I'm only editing the ASCX page (this is the page's entire code above)
the codebehind uses C#, which i don't have & know.
I was asked to see if i can add more information on the header page from the db, so i wrote a report but now can't pass the logged on user from the apsx page
@ismailc
I thought that's what we're trying to solve right now?
Please see MSDN for information about the HttpRequest.ServerVariables property.
It returns you an Array of NameValueCollection Objects...you are treating it like a Method because you are using round brackets "()"...when you should be treating it like an array by using square brakets "[]".
Could you do me a favour and post the code you're using to write the user name into the Label?
Hi, Winning a bit & getting excited (23:00) in S.A.
Changing the code to -
&User=" + "<%=Request.ServerVariables["AUTH_USER"]%>";
-
works but nothing outputs on thescreen, does not display the report as previous.
looked at the source of the page.
The report works with this value but it does not display on the page
should i not add this <body onload="setIFrameSource"> to an iframe & how?
Regards
The iFrame element supports the onload event.....
I'm not sure what you're asking...but you can call the "setIFrameSource()" method during the iFrame's onload event if you want: - <iframe id="frame1" onload="setIFrameSource()"></iframe>
Apologies, but now i have an other problem.
I pass the value & look at the source, for the value za\ismailc
the link passes ZA%5cismailc - it replaces the "\" with "%5c"
in the page code can i perhaps substring the text by removing the "za\" and returning evrything thereafter.
Please Assist and Thank You for your patience and help.
Thank You very much, really could not do this without you.
<%=(Request.ServerVariables["AUTH_USER"]).Substring(3)%> Thank You :)
The backslash ("\") is converted to %5 because "\" is a special character.
It's an "escape" character....so that it negates things that would normally have a meaning.
For example "\n" would print a new line.
But "\\n" prints "\n".
So in order to print a "\" you have to escape out the escape character like:
"\\"
For security reasons ASP.NET converts these characters into their ASCII value....%5 is the ASCII value for \
This way they aren't treated as special characters.
Consider removing the \ in the server side code.
Like:
<%=Request.ServerVariables["AUTH_USER"].split("\\")[1];%>
(Please note that this will throw an exception if the split is unsuccessful.)
Oh you answered your question before I could finish answering it.
The SubString method works well too :D
I'm glad you solved it!
-Frinny
Impossible without you :)
Keep well, hope i don't bother you soon.
Thank You
Hi,
I have a similar issue where I am trying to pass the user ID from a WSS V3 site to an Oracle Forms Application server...do you think this approach can help?
The solution discussed above helps to pass information from a web page to another web page.
I don't know if it will work with Windows SharePoint Services because I've never really used them before.
Are you using Web Pages to access both the Windows SharePoint Service and your Oracle Forms Application?
What are you trying to do?
I have a Sharepoint site (WSS) that will be calling a aspx document through a page viewer web part. In this aspx document is code that pulls the current user id (including domain) then displays it. The document also has JavaScript that starts a form applet via an Oracle Forms Application Server.
Problem:
Trying to get that user id :(<xsl:param name="LogonUser"/>) into the JS code: (document.writeln('<PARAM NAME="serverArgs" VALUE="module=svilsim.fmx' + ' userid='+ getParm('vsuccess') + ' Name=' + vparam +'">');)
so that no login is required by the user when they access this page.
I was trying to recreate this and got this error:
An error occurred during the compilation of the requested file, or one of its dependencies. ; expected
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Chad |
last post by:
Alright, I've been searching all over and it seems I'm just not looking
for the right thing, since what I want to do seems extremely simple I
just don't know the correct syntax. All I get is how to...
|
by: Niclas Lindblom |
last post by:
Hi,
I would like to use a separate stylesheet for a .ascx module without
changning the stylesheet that is referenced in the .aspx page <HEAD>
section
Is it possible to reference another...
|
by: Jay Douglas |
last post by:
I have a set of pages that inherit from a base class in the App_Code folder.
The class looks something like:
public class MyBaseClass : System.Web.UI.Page
In various stages of the life cycle I...
|
by: Bharath |
last post by:
Hi All,
I'm embedding a windows user control in aspx page and showing the user
control in the IE, the problem that I'm facing is that the user session
of the parent application is getting expired...
|
by: Brenden Bixler |
last post by:
I have a user control, dropdown.ascx
Inside dropdown.ascx, I have a dropdownlist control.
From my page.aspx, I need to be able to access the dropdown's value.
By setting it to auto-post...
|
by: krallabandi |
last post by:
I have a hidden control
<input id="FieldSortOrder" type="hidden" name="FieldSortOrder"
runat="server"> in a ascx page. I want to store some value in this
control in the code behind page.
...
|
by: Jason |
last post by:
I am trying to dynamically add a web user control - ctrlBlogEntry.ascx
- to a page - default.aspx - (via an ASP:PlaceHolder). This web user
control has two ASP:Label controls and I'm accessing...
|
by: strikefiend |
last post by:
Ok, I'm somewhat new to .NET C# language and am having a bit of trouble.
I'm trying to run the javascript confirm() method from my ascx page but I'm currently using C# as the main language of the...
|
by: Montu76 |
last post by:
Hi All,
I want to pass values from .apsx page(textbox value) to .ascx page.
Any sort of help will be appreciated.
Regards
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |