|
Look here[^]
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi,
I want to have a set of "export" buttons which generates a different type of report when the user clicks any of these, and then prompts the user to download the generated report (let's say that this report is an xls file).
What should I do so that when the user clicks the button, it will not post-back the page and still prompt the user to download?
Is there any control that I can use?
Thanks.
Rafferty
|
|
|
|
|
Global.ASAX
<%@ Application Codebehind="Global.asax.vb" Inherits="AdamItiel.GlobalApp" Language="vb" %>
Global.ASAX.VB
<br />
Imports System.Web.SessionState<br />
<br />
Namespace AdamItiel<br />
Public Class GlobalApp<br />
Inherits System.Web.HttpApplication<br />
<br />
Private Shared userFirstNameVal As String<br />
Public Shared Property UserFirstName() As String<br />
Get<br />
Return userFirstNameVal<br />
End Get<br />
Set(ByVal value As String)<br />
userFirstNameVal = value<br />
End Set<br />
End Property<br />
<br />
Private Shared newPropertyValue As String<br />
Public Shared Property UserLastname() As String<br />
Get<br />
Return newPropertyValue<br />
End Get<br />
Set(ByVal value As String)<br />
newPropertyValue = value<br />
End Set<br />
End Property<br />
<br />
<br />
Private Shared newPropertyValue2 As String<br />
Public Shared Property ClientTypeDesc() As String<br />
Get<br />
Return newPropertyValue2<br />
End Get<br />
Set(ByVal value As String)<br />
newPropertyValue2 = value<br />
End Set<br />
End Property<br />
<br />
Private Shared newPropertyValue3 As String<br />
Public Shared Property Coach() As String<br />
Get<br />
Return newPropertyValue3<br />
End Get<br />
Set(ByVal value As String)<br />
newPropertyValue3 = value<br />
End Set<br />
End Property<br />
<br />
<br />
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)<br />
' Fires when the application is started<br />
End Sub<br />
<br />
Sub Session_Start(ByVal sender As Object, ByVal e As EventArgs)<br />
' Fires when the session is started<br />
End Sub<br />
<br />
Sub Application_BeginRequest(ByVal sender As Object, ByVal e As EventArgs)<br />
' Fires at the beginning of each request<br />
End Sub<br />
<br />
Sub Application_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs)<br />
' Fires upon attempting to authenticate the use<br />
End Sub<br />
<br />
Sub Application_Error(ByVal sender As Object, ByVal e As EventArgs)<br />
' Fires when an error occurs<br />
End Sub<br />
<br />
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)<br />
' Fires when the session ends<br />
End Sub<br />
<br />
Sub Application_End(ByVal sender As Object, ByVal e As EventArgs)<br />
' Fires when the application ends<br />
End Sub<br />
<br />
End Class<br />
End Namespace<br />
<br />
<br />
Default.aspx
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="AdamItiel._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
QQQQQQQQQQQQQQQQQ
</div>
</form>
</body>
</html>
Default.aspx.VB
Namespace AdamItiel<br />
<br />
Public Partial Class _Default<br />
Inherits System.Web.UI.Page<br />
<br />
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load<br />
<br />
End Sub<br />
<br />
End Class<br />
<br />
End Namespace<br />
<br />
Why do I get "Could not load type 'AdamItiel.GlobalApp'"?
|
|
|
|
|
Hi all,
In my website I have made program that if any error will come then an email comes to me.
I want to also know IP address,browsertype etc.. of that machine in the email.
Thanks to all..
|
|
|
|
|
code is below
Request.ServerVariables["REMOTE_ADDR"]
|
|
|
|
|
Thanks Dear,
But how can we get browser informatio ?
|
|
|
|
|
Look at this [^]one.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
you can get the information by Request.Browser.*.
For example
Request.Browser.Browser
you can get the user browser
|
|
|
|
|
private string GetClientIP()
{
string result = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (null == result || result == String.Empty)
{
result = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
}
if (null == result || result == String.Empty)
{
result = HttpContext.Current.Request.UserHostAddress;
}
return result;
}
April
Comm100 - Leading Live Chat Software Provider
modified 27-May-14 8:54am.
|
|
|
|
|
hi,
i am developing a web application where i am using asp:menu control to display menus.
ie version is ie7.
when there is less amount of data on a page the menu renders faster. Now for certain pages where i am using asp:Listbox control, when there are many items in the listbox control, the menu items are displayed slow. it takes some seconds to display the child menu items onhover. when there are lesser items in listbox the menu control render fast. This happens in ie7,but in ie6 that is not an issue. the menu displays faster in ie6 even when there is large amount of data in listbox
Sandeep Kumbhar
|
|
|
|
|
Hi,
I need to develop a .Net application that will store documents and enable users to read or write. While, Read access is available for all users, updates are allowed for only the user who has checked it out. This is similar to a version control application. I also have to store all the versions of the file. Please let me know the architectural/development details and efforts in terms of technology for such an application. Please point me to any resources/samples available. Any suggestions are appreciated.
Thanks.
|
|
|
|
|
This site is for specific questions--like you have a compile error, or getting unexpected results. This site is NOT for over-generic questions and how to teach you to use Google.
|
|
|
|
|
Hey I wanted to pose a couple of newbie questions. Sorry in advanced if they have already been asked in this forum, and thanks in advanced for those who volunteer or otherwise answer these types of questions. I know how the answer people can sometimes feel like their answers and efforts aren't appreciated by dummies, and can get jaded as a result.
Anyway, here are my questions:
1. I have a design or achitecture question. I want users to upload files to a shared mapped file drive, call it the "z:" drive where they can upload images or videos. I already have the code that will upload the images and such. But now I want serve those images or videos without physically moving/copying them to my server directory...I can't figure out how to do that as the absolute or relative path. Can anyone help me by providing a download url that has sample code that can do this? or point me in the right direction with some tutorial urls of what I'm looking for?
2. Last question (do I need to post this in a separate post? - that's not the question ). I would like have one .aspx affect a different .aspx page for seo reasons. Is there any way to do it programmatically? So I don't have to keep changing the page and then republishing to the web server? If so, any tutorials with sample code to do so?
Thanks!
|
|
|
|
|
1) You should be able to access your uploaded images (etc), by referencing them like "\\myimageserver\images\Photo1.jpg". You would just need to setup the necessary file sharing security for the IIS process to be able to read the file share and NTFS permissions. If anyone knows differently, please correct me ... I'm just thinking out loud.
2) So are you telling us that you have a page1.aspx actually modifying the contents of page2.aspx ? Wow, I've never done that ... I guess it's possible. Can you describe the actual situation with a bit more detail ? Maybe I could get a better understanding.
Always good to ask questions, how else are you going to learn ? I ask plenty of them.
|
|
|
|
|
clarification for #2: yes that's exactly what I want to do. I don't think it's possible though, just not sure.
on point #1, I don't think that works as I have tried that already, but if you get it to work, I'd love to see some code examples.
Thanks!
|
|
|
|
|
1) As long as the proper permissions have been applied to the folder I don't see why it shouldn't work
2) You could use some inline script within the head element
<head runat="server">
<%= InsertMeta() %>
</head>
protected string InsertMeta()
{
return @"<meta name='Test' content='Some value' />";
}
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi All.
How to get mac address of a client system in asp.net??
I need to identify client system uniquely other than using IP address.
If there is any other way for achieving the same please suggest...
Thanks and Regards
Mithun Narayanan.
|
|
|
|
|
And it involved this very issue. And a Senior MS Consultant (I hate to admit) showed me the path towards righteousness. Basically, your MAC address gets replaced with each frame along each router or some such non-sense. Meaning that outside your local network the MAC is meaningless. Much worse, some TCP/IP stacks do not even provide it through the API so you would need to really write some code to get it.
http://tools.ietf.org/html/rfc1122[^]
http://en.wikipedia.org/wiki/Ethernet[^]
|
|
|
|
|
In case of ASP.NET it is a client server architecture.. So you can only get things that are sent through request object.
As every request is made by the browser (client) you can add the mac address to it and send it.
So only option is your IP.... which is also the external one.
|
|
|
|
|
Sorry i cant use IP... if am using it i cant uniquly identify systems under a particular network... is ther any other way... i can it thru javascript but i ve to enable ActiveX which i dont want...
is ther any other way.??
|
|
|
|
|
Hi,try to do this.
using System.Management;
string stringMAC = "";
string stringIP = "";
ManagementClass MC = new ManagementClass "Win32_NetworkAdapterConfiguration");
ManagementObjectCollection MOC= MC.GetInstances();
foreach(ManagementObject MO in MOC)
{
if ((bool)MO["IPEnabled"] == true)
{
stringMAC += MO["MACAddress"].ToString();
TextMAC.Text = stringMAC.ToString();
string[] IPAddresses = (string[]) MO["IPAddress"];
if(IPAddresses.Length > 0)
stringIP = IPAddresses[0];
TextIP.Text = stringIP.ToString();
}
}
April
Comm100 - Leading Live Chat Software Provider
modified 27-May-14 8:54am.
|
|
|
|
|
Thank u for the response.. i ll try this nd revert ..
|
|
|
|
|
ha ha ...
this will give you the Mac address of the Server. ..
|
|
|
|
|
i knw tat... i ve tried it long back ago...
|
|
|
|
|
Hi, you can refer to the following code:
[DllImport("Iphlpapi.dll")]
private static extern int SendARP(Int32 dest,Int32 host,ref Int64 mac,ref Int32 length);
[DllImport("Ws2_32.dll")]
private static extern Int32 inet_addr(string ip);
private void Page_Load(object sender, System.EventArgs e)
{
// initial page
try
{
string userip=Request.UserHostAddress;
string strClientIP = Request.UserHostAddress.ToString().Trim();
Int32 ldest = inet_addr(strClientIP); //client ip
Int32 lhost = inet_addr(""); //server ip
Int64 macinfo = new Int64();
Int32 len = 6;
int res = SendARP(ldest,0, ref macinfo, ref len);
string mac_src=macinfo.ToString("X");
if(mac_src == "0")
{
if(userip=="127.0.0.1")
Response.Write ("Localhost!");
else
Response.Write ("welcome IP = " + userip + "<br>");
return;
}
while(mac_src.Length<12)
{
mac_src = mac_src.Insert(0,"0");
}
string mac_dest="";
for(int i=0;i<11;i++)
{
if (0 == (i % 2))
{
if ( i == 10 )
{
mac_dest = mac_dest.Insert(0,mac_src.Substring(i,2));
}
else
{
mac_dest ="-" + mac_dest.Insert(0,mac_src.Substring(i,2));
}
}
}
Response.Write ("welcome IP = "+userip+ "<br>" + ",MAC = "+mac_dest
+ "<br>");
}
catch(Exception err)
{
Response.Write(err.Message);
}
}
April
Comm100 - Leading Live Chat Software Provider
modified 27-May-14 8:54am.
|
|
|
|