|
Hi yr cheguevara..
To have the ideas of to become good sound in asp.net to know the following languages
HTML
Javascript
SQLserver For database connection
ASP
|
|
|
|
|
Hi,
you have to good command on c# or Vb.net
|
|
|
|
|
Response.Clear()
Response.AddHeader("Content-Disposition", "attachment; filename=" xmlfile)
Response.AddHeader("Content-Length", file.Length.ToString()) Response.ContentType = "xml" ' "application/octet-stream"
Response.WriteFile(file.FullName)
Response.End()
using this code iam download an xml file then iam getting open save and cancel window when iam click on open then the download file is opening in the same page which makes my application is not visible. how to make download file to be open in the another window
|
|
|
|
|
Try to create a new page and add that code.
Redirect to that page, from a link that contains TARGET="_blank" , or use javascript, window.open() to show that page.
Calin
|
|
|
|
|
Hello,
How to redirec From Https to Http page in same Web Application
In Asp.net 2.0
Ravindra Jain
|
|
|
|
|
Hello Everybody
in my page i need to read file (.doc,.txt,.rtf) and find out mobile numbers to which i am to send sms
its working fine on localhost but onupload on ftp its giving following error..
Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80040154.
Thanks
|
|
|
|
|
You haven't provided enough details to answer this question. Please explain clearly what you are trying to do.
|
|
|
|
|
thanks for reply..
there is an excel file (can be .txt,.rtf,.doc) containing mobile number with some text
now the problem is that i successfully retrieve the numbers while running project on localhost but
when i upload the compiled code on ftp then on reading that file its giving the following error.
Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80040154.
|
|
|
|
|
You have to either have Excel installed on the server, or a free package Microsoft has that let's a server access the DLLs required. Can't remember what it's called, but it should give ya some Google key words.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
if it is so then why its giving same error with .txt file?
|
|
|
|
|
am resizing the uploaded image and also adding the watermark, that code as follows, but now am saving the image into local path, i want to save this image into sql server database. how can i do that. can i get some source code for that.
int thumbWidth = 0;
System.Drawing.Image image = System.Drawing.Image.FromFile(cmdBrowse.PostedFile.FileName);
if (image.Width > 500)
{
thumbWidth = 500;
}
else
{
thumbWidth = image.Width;
}
int srcWidth = image.Width;
int srcHeight = image.Height;
Decimal sizeRatio = ((Decimal)srcHeight / srcWidth);
int thumbHeight = Decimal.ToInt32(sizeRatio * thumbWidth);
Bitmap bmp = new Bitmap(thumbWidth, thumbHeight);
System.Drawing.Graphics gr = System.Drawing.Graphics.FromImage(bmp);
gr.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
gr.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
gr.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High;
System.Drawing.Rectangle rectDestination = new System.Drawing.Rectangle(0, 0, thumbWidth, thumbHeight);
gr.DrawImage(image, rectDestination, 0, 0, srcWidth, srcHeight, GraphicsUnit.Pixel);
Font font = new Font("Verdana", 14, FontStyle.Bold, GraphicsUnit.Pixel);
Color color = Color.FromArgb(100, 0, 0, 0);
Point pt = new Point(2, 3);
SolidBrush sbrush = new SolidBrush(color);
gr.DrawString("www.Test.com", font, sbrush, pt);
bmp.Save("E:/Images/Test.bmp");
bmp.Dispose();
image.Dispose();
|
|
|
|
|
Robymon wrote: can i get some source code for that.
Here[^] you go. You also try the CP discussion board search. This question is getting asked almost daily.
|
|
|
|
|
|
Ok. Instead of saving the bitmap into a file, save it to a memory stream and get the bytes from it to save to database. You need to use the other overload of Save which takes a Stream . GetBuffer[^] method will give you the byte array which can be saved to database then.
|
|
|
|
|
Hi.
I have an UpdatePanel in a UserControl that there is a button on it.
By clicking the button I want to add a control (textBox) dynamically to my WebForm.
but it doesn't work.
If I remove the UpdatePanel that works, but with UpdatePanel Not.
What can I do?
Best wishes
|
|
|
|
|
in the update panel there is a tag for postback,give the button id in that postback.
|
|
|
|
|
So, am I right in saying that your button is doing a postback and your page is reloading(no ajax)? If this is the case then I think it's the Triggers section of the UpdatePanel that you're missing. See my sample code below (you can ignore the content, it's just a report I knocked up). I've made bold and italic the Triggers section I think you could be missing. Also, the code where your dynamic control will be added will have to go in the ContentTemplate section of your UpdatePanel.
My apologies if I've missed the point and you're already doing this.
<asp:Button ID="btnRun_TopHopFaults" runat="server" Text="Run Report"
OnClick="btnRun_TopHopFaults_Click" />
<asp:UpdatePanel id="pnlTopHopFaultsResults" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnRun_TopHopFaults" />
</Triggers>
<ContentTemplate>
<asp:Repeater ID="repTopHopFaults" runat="server">
<HeaderTemplate>
<table>
<tr>
<th></th>
<th>Guidance Ref</th>
<th>Guidance</th>
<th>Quantity</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><%#DataBinder.Eval(Container.DataItem, "Position") %></td>
<td><a href='<%#string.Concat("javascript:showHopDrillDown(", DataBinder.Eval(Container.DataItem, "ID"), ")")%>'>
<%#DataBinder.Eval(Container.DataItem, "FieldRef") %>
</a>
</td>
<td><%#DataBinder.Eval(Container.DataItem, "Field") %></td>
<td><%#DataBinder.Eval(Container.DataItem, "FaultCount") %></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</ContentTemplate>
</asp:UpdatePanel>
Let me know how you get on...
|
|
|
|
|
Dear Experts,
I have encrypt and decrypt of string using AES Algorithm in Java.I want use these code in asp.net.when i convert these codes Namespace doesnot support.
Another hand i want to create encrypt and decrypt of one string using AES algorithm (spec Autokey generation)using asp.net.
If any body have idea Kindly inform me
Thank you
Regards
Mani.Thirumalai
|
|
|
|
|
There's a cryptography namespace in .NET. Your question actually has nothing to do with ASP.NET, you should nominate what language you're using and ask in that forum.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Dear Graus
Here i give the Java code. I want follow these function in asp.net.
My Java codes as follows as
import java.io.FileInputStream;
import java.io.DataInputStream;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
public class AESEncryptDecrypt {
//method to read key from the file.
private SecretKeySpec readKey() {
SecretKeySpec skeySpec=null;
try{
FileInputStream fis=new FileInputStream("D:\\keyfile.txt");
DataInputStream disFile=new DataInputStream(fis);
String key=disFile.readLine();
BASE64Decoder base64 = new BASE64Decoder();
byte[] bts=base64.decodeBuffer(key);
skeySpec = new SecretKeySpec(bts,"AES");
}catch(Exception e) {
System.out.println("error "+e);
}
return skeySpec;
}
//Method for encrypt the input value using the secret key
private String Encrypt(String msg ,SecretKeySpec skeySpec){
String hexString="";
try
{
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
byte[] encrypted = cipher.doFinal(msg.getBytes());
hexString=asHex(encrypted);
}catch(Exception e)
{
System.out.println("Error in Encrypt"+e);
}
return hexString;
}
//Method for decrypt the input value using the same secret key
private String Decrypt(String hexString,SecretKeySpec skeySpec)
{
String originalString = "";
try
{
Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.DECRYPT_MODE, skeySpec);
byte[] bts = new byte[hexString.length() / 2];
for (int i = 0; i < bts.length; i++) {
bts[i] = (byte) Integer.parseInt(hexString.substring(2*i, 2*i+2), 16);
}
byte[] original = cipher.doFinal(bts);
originalString = new String(original);
}catch(Exception e)
{
System.out.println("Error in Decrypt"+e);
}
return originalString;
}
private String asHex(byte bytes[]){
StringBuffer retString = new StringBuffer();
for (int i = 0; i < bytes.length; ++i)
{
retString.append(Integer.toHexString(0x0100 + (bytes[i] & 0x00FF)).substring(1));
}
return retString.toString();
}
public static void main(String args[]){
AESEncryptDecrypt cryptoEnc = new AESEncryptDecrypt();
SecretKeySpec keySpec=cryptoEnc.readKey();
// Input For Encryption
String hexString = cryptoEnc.Encrypt("Sample Input Text",keySpec);
System.out.println("encrypted string: " + hexString);
// For Decryption
String originalString = cryptoEnc.Decrypt(hexString,keySpec);
System.out.println("Original string: " +originalString);
}
}
Reply me
Thanx
|
|
|
|
|
So, are you expecting him to convert this code to ASP.NET?
Look into the System.Security.Cryptography and work with the classes provided.
|
|
|
|
|
Dear Navaneeth
Thanx for reply.I had converted Java code to asp.net code using Java to vb.Net converter.
Here problem is SecretKeySpec,Cipher these are not supporting in .net.even if i using following classes also.
Imports System.Security.Cryptography
Imports System.Security.Cryptography.CipherMode
Imports System.Security.Cryptography.CryptoConfig
Imports System.Security.Cryptography.CryptoStream
I give the my codes as your refernce
Imports System
Imports System.Security.Cryptography
Imports System.Security.Cryptography.CipherMode
Imports System.Security.Cryptography.CryptoConfig
Imports System.Security.Cryptography.CryptoStream
Public Class JavaToAspNet
Inherits System.Web.UI.Page
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim keySpec As SecretKeySpec = readKey()
' Input For Encryption
Dim hexString As String = Encrypt("Sample Input Text", keySpec)
Response.Write("encrypted string: " & hexString)
' For Decryption
Dim originalString As String = Decrypt(hexString, keySpec)
Response.Write("Original string: " & originalString)
End Sub
'method to read key from the file.
Private Function readKey() As SecretKeySpec
Dim skeySpec As SecretKeySpec = Nothing
Try
Dim fis As New FileInputStream("D:\keyfile.txt")
Dim disFile As New DataInputStream(fis)
Dim key As String = disFile.readLine()
Dim base64 As New BASE64Decoder
Dim bts() As SByte = base64.decodeBuffer(key)
skeySpec = New SecretKeySpec(bts, "AES")
Catch ex As Exception
Response.Write(ex.Message)
End Try
Return skeySpec
End Function
'Method for encrypt the input value using the secret key
Private Function Encrypt(ByVal msg As String, ByVal skeySpec As SecretKeySpec) As String
Dim hexString As String = ""
Try
Dim cipher As Cipher = Cipher.getInstance("AES")
cipher.init(Cipher.ENCRYPT_MODE, skeySpec)
Dim encrypted() As SByte = cipher.doFinal(msg.getBytes())
hexString = asHex(encrypted)
Catch ex As Exception
Response.Write(ex.Message)
End Try
Return hexString
End Function
'Method for decrypt the input value using the same secret key
Private Function Decrypt(ByVal hexString As String, ByVal skeySpec As SecretKeySpec) As String
Dim originalString As String = ""
Try
Dim cipher As Cipher = Cipher.getInstance("AES")
cipher.init(Cipher.DECRYPT_MODE, skeySpec)
Dim bts(hexString.Length / 2 - 1) As SByte
For i As Integer = 0 To bts.length - 1
bts(i) = CSByte(Convert.ToInt32(hexString.Substring(2 * i, 2 * i + 2), 16))
Next i
Dim original() As SByte = cipher.doFinal(bts)
originalString = New String(original)
Catch ex As Exception
Response.Write(ex.Message)
End Try
Return originalString
End Function
Private Function asHex(ByVal bytes() As SByte) As String
Dim retString As System.Text.StringBuilder = New System.Text.StringBuilder
For i As Integer = 0 To bytes.Length - 1
retString.Append(Integer.toHexString(&H100 + (bytes(i) And &HFF)).Substring(1))
Next i
Return retString.ToString()
End Function
End Class
Thanx
reply me
Regards
Mani
|
|
|
|
|
Hi friends,
We have used import excel option, in our web application. Is it necessary that MS office to be installed in the hosting server i.e where the application resides or just the dll added as reference will support to run the application.
Please guide us.
Every Successful Person Have A Painful Story
|
|
|
|
|
As far as I know, Excel needs to be installed on a machine that tries to interop with it. The dlls just provide a bridge to Excel itself.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
If you only need to access the actual data without the formatting, you can use OLEDB which is built in to dotnet.
|
|
|
|