|
how to create pdf file using ASP.Net without third party tools or components? ..
I need Code to be written for that....
Any help will be greatly appreciated...
Varun Khanna
|
|
|
|
|
Simply, PDF document has its own native format which is not supported by any programming language as a default. You MUST have to use 3rd party component for creating PDF documents from your application.
If you come across any solution without any 3rd party solution, you can beat Adobe and other competitors and then please do share it with me (atleast)!
|
|
|
|
|
use builtin utility of crystal report
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
Hi All ,
I am working with Asp.net 2.0 C# and my database is SQl 2005 .I hve a problem with putting Login Validation . I want tht when user enters username and Password it should be verified with database if ID PWD matches then user should be logged in and if it doesn't match then it should give login failed . Can u plz pass on d code if possible .
Thanks in advance
|
|
|
|
|
1. Write sql query string to get ID of user and fill dataset if username and password wont be matched it returns value 0.If ID is 0 give msg that Login Failed otherwise it successed.
2. U can also check that if ds.rows.count==0 return false for login failed otherwise true.
Best Regards
Pathan
|
|
|
|
|
I have given this code
<title>WebForm1
Login:
| <asp:textbox id="txtUserName" runat="server" width="160px"><asp:requiredfieldvalidator id="rvUserValidator" runat="server" controltovalidate="txtUserName" errormessage="You must supply a Username!"
="" display="None"> | Password:
| <asp:textbox id="txtPassword" runat="server" width="160px" textmode="Password"><asp:requiredfieldvalidator id="rvPasswordValidator" runat="server" controltovalidate="txtPassword" errormessage="Empty Passwords not accepted"
="" display="None"> | <asp:button id="cmdSubmit" runat="server" text="Submit" borderstyle="Solid"> |
|
<asp:validationsummary id="Validationsummary1" runat="server" width="472px" displaymode="BulletList"> |
|
<asp:label id="lblMessage" runat="server" width="288px" font-bold="True" font-italic="True"
="" font-size="Medium" forecolor="#C00000">
<asp:label id="lblMessage2" runat="server" width="288px" font-bold="True" font-italic="True"
="" font-size="Medium" forecolor="#C00000">
and my code behind is
private void InitializeComponent()
{
this.cmdSubmit.Click += new System.EventHandler(this.cmdSubmit_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void cmdSubmit_Click(object sender, System.EventArgs e)
{
if (Page.IsValid)
{
if (DBConnection(txtUserName.Text.Trim(), txtPassword.Text.Trim()))
{
FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, false);
}
else
{
lblMessage.Text = "Invalid Login, please try again!";
}
}
}
private bool DBConnection(string txtUser, string txtPass)
{
SqlConnection myConn = new SqlConnection(ConfigurationManager.AppSettings["strConn"]);
SqlCommand myCmd = new SqlCommand("sp_ValidateUser", myConn);
myCmd.CommandType = CommandType.StoredProcedure;
SqlParameter objParam1;
SqlParameter objParam2;
SqlParameter returnParam;
objParam1 = myCmd.Parameters.Add("@UserName", SqlDbType.VarChar);
objParam2 = myCmd.Parameters.Add("@Password", SqlDbType.VarChar);
returnParam = myCmd.Parameters.Add("@Num_of_User", SqlDbType.Int);
objParam1.Direction = ParameterDirection.Input;
objParam2.Direction = ParameterDirection.Input;
returnParam.Direction = ParameterDirection.ReturnValue;
objParam1.Value = txtUser;
objParam2.Value = txtPass;
try
{
if (myConn.State.Equals(ConnectionState.Closed))
{
myConn.Open();
myCmd.ExecuteNonQuery();
}
if ((int)returnParam.Value < 1)
{
lblMessage.Text = "Invalid Login!";
return false;
}
else
{
myConn.Close();
return true;
}
}
catch (Exception ex)
{
lblMessage2.Text = ex + "Error Connecting to the database";
return false;
}
}
}
protected void Page_Load(object sender, EventArgs e)
{
}
}
I m not able to rectify d error . This code neither give error nor does it show me d output.
|
|
|
|
|
Hi Guys
I have developed a web application in which I have an admin folder.I want to protect that folder.After logging in the admin users must be redirected to a page under that folder and not to the default page of the web application.If you have any coding or suggestions related to this issue ,please send it
Thanks
|
|
|
|
|
If you are using FormsAuthentication to do your login, you can enter a bit into the web.config:
<configuration>
<location path="Admin">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
</configuration>
This means that it will deny access to any unknown users (the deny users="?") who try to access the path /Admin/
|
|
|
|
|
Yes.Thanks. After logging in , it redirects to the default page of the web application.But I want to redirect the Admin Users to a form or page inside this protected folder.
Thanks
jith
|
|
|
|
|
If you have a defaultUrl= in your authentication settings, it will redirect to that page after login.
<authentication mode="Forms">
<forms name=".ASPXAUTH" loginUrl="login.aspx" timeout="20"
protection="All" slidingExpiration="true" defaultUrl="/Admin/MyAdminPage.aspx"/>
</authentication>
ChrisB
|
|
|
|
|
Hi ChrisB
Thanks it works.
Bye
Jith
|
|
|
|
|
Hi Guys,
I want to swap 2 gif images automatically at the time gap of 6 secs in the header banner,of ASP.NET web application.If anybody knows the coding for this reply or give your suggestions.
Thanks
|
|
|
|
|
Hi
You can use AJAX for this. Add Timer control and add Timer_Tick event to swap images.
Hope you got it.
Harini
|
|
|
|
|
Why would you need Ajax for this? That would be a bit over board.
It can easily be done in Javascript using the setTimeout function. Set this to a function reference in the onload event, the function will swap the image.
window.onload = function(){ setTimeout('imageSwap', 6000); }
var swap = true;
function imageSwap() {
var img = document.getElementById['imageElId'];
if(swap) { img.src = 'newimage.jpg'; swap = false; }
else { img.src = 'oldimage.jpg'; swap = true; }
}
Thats off the top of my head so I'm sure it'll need some tweaks.
|
|
|
|
|
hi badgrs,
i tried this code.But there is no property,method or event called window.removed.
Thanks
jith
-- modified at 5:54 Friday 9th March, 2007
|
|
|
|
|
It should be onload , it gets removed by CP for security reasons.
|
|
|
|
|
|
"header banner" means exactly whats exactly you are talking about !!!
Is that something two image control's image you want to swap periodically ???
Thanks,
Arindam D Tewary
|
|
|
|
|
Yes and I don't want mouseover or mouseout events
Thanks,
jith
|
|
|
|
|
Any particular reason why you can't use an adrotator control? That would seem to be the simplest...
Other than that, all you need to do is set up a function to toggle the images...something like...
function rotateImage()
{
var currentImage = document.getElementById('myImage').src;
if (currentImage = 'imgage1.gif')
{
document.getElementById('myImage').src = 'image2.gif';
}
else
{
document.getElementById('myImage').src = 'image1.gif';
}
setTimeout ('rotateImage();', 6000)
}
should do the trick - call it once at page load, and it'll just sit there munching away till the page is binned
"Now I guess I'll sit back and watch people misinterpret what I just said......"
Christian Graus At The Soapbox
|
|
|
|
|
Hi,
Thanks for giving the idea of AdRotator.But how to display 2 images with 6 seconds interval.
Thanks
Jith
|
|
|
|
|
Hi
I'm in need of some code segment to create a .cab file in my application. I got one CabLib.dll from one link provided by codeproject itself. But it worked weel in local machine.But it doesn't work in server after uploading. (I read in some article that we can use System.Web.Util class. But it doesn't support the cab creation now.
Could anyone please help me to locate some dll's or built in class in .net to solve this problem?
Nicejith
|
|
|
|
|
There is a system provided utility makecab.exe (present in c:\windows\system32 folder) which you can invoke with relevant parameters to generate the cab file from your C# application. You can start the process using System.Diagnostic.Process object and use Start method to start the process for using in your code.
Let me know if you need any more help in this regard.
|
|
|
|
|
Hi Guys,
I am using a coding for the number of hits in a web application.I have used the database to store the number of hits.My problem is I am able to update the hits in the database.But the variables which I have used in Session is unable to store the value and retrieve it when the page loads.
Please give your sugesstion
Thanks
|
|
|
|
|
Dear jithbiz0033,
If you want to implement something like that I think
1.you must use application variables not a session variables.
2.And you have to write code in Application_OnBeginRequest() event handler in global.asax file. So any updation of your application variable must be done inside Application_OnBeginRequest() functiion.
3.While updating inside Application_OnBeginRequest() , you can use Lock property also in case you want to get out of concurrentcy problem.
Hope these helps you,
Thanks,
Arindam D Tewary
|
|
|
|