|
Hi,
In web application using Asp.net 2.0 and c# .
I have written code for Cropping images .It is working fine in IE Browser. But giving exception as "Parameter not valid "
in
" System.Drawing.Bitmap thumbBitmap = new System.Drawing.Bitmap(fs, true); "
statement of following code snippet .
I dont understand how to solve this problem.
(Or you can suggest some another way of cropping images that doesn't use System.Windows namespace.)
Please Guide.
Code:
FileStream fs = new FileStream(FileUpLd.PostedFile.FileName, System.IO.FileMode.OpenOrCreate);
System.Drawing.Bitmap thumbBitmap = new System.Drawing.Bitmap(fs, true);
thumbBitmap = (Bitmap)thumbBitmap.GetThumbnailImage(75, 75, new System.Drawing.Image.GetThumbnailImageAbort(ThumbCollback), IntPtr.Zero);
Context.Response.ContentType = "image/Jpeg";
thumbBitmap.Save(Server.MapPath("") + "\\Images\\ProfileImages\\" + FileNameOnServer, System.Drawing.Imaging.ImageFormat.Jpeg);
thumbBitmap.Dispose();
fs.Close();
yog
hui gfgh kgdgrt njjn hjgkn
|
|
|
|
|
try this
Bitmap bm = new Bitmap( Server.MapPath("b2346.jpg"));
Response.Write ("Height :" + bm.Height.ToString() );
Response.Write (" Width :" +bm.Width.ToString() );
|
|
|
|
|
How can i unzip the zip file during the uploading.....
acutally i need to upload a zip file and when user upload zip file and click Upload button, the function unzip the folder first and then save it at desired location.
Feroze
|
|
|
|
|
Hi All,
Can any one tell me hw to disable the close, minimize buttons of title bar in browser with the help of javascript. Or how to remove the title bar from browser.
Code:
str = "window.open('previous.aspx','','location=0,resizable=0,ScrollBars=1,statusbar=1,TitleBar=0,width=680,height=600'); "
Page.RegisterStartupScript("abc", str)
|
|
|
|
|
You can't disable the buttons, and I doubt you can remove the title bar, perhaps in a popup.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
hi all!
i need some help from u guys..im just startin off with the desingnin and coding for a project that is mandatory within the curriculum of a .net course im doin at a local institute..the topic ive suggested is an airline information and reservation system..my basic plans are to start off with the designing of webforms(asp.net), tables using sql server 2000 and some front page postings..anyways hope u guys can provide me with a better start and implementation..thankyou..cya
|
|
|
|
|
You should probably design the screens first, then think about how the data layer should be put together. That will make your business needs clearer. Beyond that, it's hard to give advice on such a broad question.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
I`ve an asp.net project with lots of query strings, now can i secure all query strings (i mean encryption/decryption) using any procedure? i dont want to touch the code. Is there any easy way using IIS/web.config or whatever to secure all query strings of the project without affecting code?
|
|
|
|
|
May be u can remove the address bar of IE...
|
|
|
|
|
Goto IIS>Rightclick on your project>properties>DirectorySecurity>Edit Secure communications.
>check the first option(Require Secure Channel).
>check the accept client certificates.
Kiran Kumar.CH
(MCP)
|
|
|
|
|
why the edit button is disabled on my machine ??
When you get mad...THINK twice that the only advice
Tamimi - Code
|
|
|
|
|
Hi all,
I want create year calendar means show all months
i am using asp.net
thanks,
|
|
|
|
|
What exactly u want to do???U want to give year scroll to calender control or u want to display all months of any year???
|
|
|
|
|
hi,
thanks for reply,
i want display all months in a year.
thanks
|
|
|
|
|
I have 2 combo named state and city.When I select state, all the related city must be loaded.I am using Ajax for this. Values of state are getting set with state Id and State name and same with city is also happening through the script.
My problem is that I am not getting the values of city on my code behind page.I getting it blank.
Please tell me how will I get the selected city name and ID
Thanks is advance...
|
|
|
|
|
1) Currently, how are you trying to access the city values?
2) Can you show the markup for the city dropdown?
3) What is the error you are getting?
Shreekar
|
|
|
|
|
Thanks for the reply:
1)This code is of AjaxServerPage.aspx.vb
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim strSelectedItem As String = Request("selectedItem")
Dim lngId As Long
Dim strSql As String = ""
Dim oDT As Data.DataTable
Dim objDB As New CDataBase
'
If Not IsNothing(strSelectedItem) Then
lngId = IIf(Len(strSelectedItem) = 2, Right(strSelectedItem, 1), Right(strSelectedItem, 2))
If Left(strSelectedItem, 1) = "C" Then
strSql = "Select * from StateMaster where countryid = " & lngId
Else
strSql = "Select * from CountyMaster where stateid = " & lngId
End If
Else
lngId = 0
Exit Sub
End If
strSql = strSql & " And IsActive = 1"
'
Dim strTemp As String = ""
oDT = objDB.ExecuteDatatable(strSql)
With oDT
If .Rows.Count > 0 Then
strTemp = "<Select>,0/"
For i As Integer = 0 To .Rows.Count - 1
strTemp = strTemp & .Rows(i).Item(2) & "," & .Rows(i).Item(0) & "/"
Next
End If
End With
'
Response.Clear()
Response.ContentType = "text/xml"
'
Response.Write(strTemp)
Response.End()
End Sub
2)This is my .js file code:
//Global XMLHTTP Request object
var XmlHttp;
AjaxServerPageName = "../AjaxServer.aspx";
//Creating and setting the instance of appropriate XMLHTTP Request object to a “XmlHttp” variable
function CreateXmlHttp()
{
//Creating object of XMLHTTP in IE
try
{
XmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
//alert ("in try after new");
}
catch(e)
{
try
{
//alert ("in catch try");
XmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(oc)
{
//alert ("in catch ");
XmlHttp = null;
}
}
//Creating object of XMLHTTP in Mozilla and Safari
if(!XmlHttp && typeof XMLHttpRequest != "undefined")
{
//alert ("in undifiend cond ");
XmlHttp = new XMLHttpRequest();
//alert ("after undifiend cond ");
}
}
//Gets called when country combo box selection changes
function CountryListOnChange()
{
//alert ("country changed");
var countryList = document.getElementById("cmbCountry");
//Getting the selected country from country combo box.
var selectedItem = countryList.options[countryList.selectedIndex].value;
selectedItem= "C" + selectedItem;
//var selectedItem = countryList.selectedIndex;
// URL to get states for a given country
var requestUrl = AjaxServerPageName + "?selectedItem=" + encodeURIComponent(selectedItem);
//alert ("after request url");
CreateXmlHttp();
//alert ("after object created");
// If browser supports XMLHTTPRequest object
if(XmlHttp)
{
//Setting the event handler for the response
XmlHttp.onreadystatechange = HandleResponse;
//Initializes the request object with GET (METHOD of posting),
//Request URL and sets the request as asynchronous.
XmlHttp.open("GET", requestUrl, true);
//alert (requestUrl);
//Sends the request to server
XmlHttp.send(null);
//alert ("after send");
}
}
//Called when response comes back from server
function HandleResponse()
{
//alert ("in handle response");
// To make sure receiving response data from server is completed
if(XmlHttp.readyState == 4)
{
// To make sure valid response is received from the server, 200 means response received is OK
if(XmlHttp.status == 200)
{
//alert("status = 200" + XmlHttp.responseText);
ClearAndSetStateListItems(XmlHttp.responseText);
}
else
{
alert("There was a problem retrieving data from the server." );
}
}
}
//Clears the contents of state combo box and adds the states of currently selected country
function ClearAndSetStateListItems(statestring)
{
//alert("clear state " + statestring);
var stateList = document.getElementById("cmbState");
//Clears the state combo box contents.
for (var count = stateList.options.length-1; count >-1; count--)
{
stateList.options[count] = null;
}
var CityList = document.getElementById("cmbCity");
if (CityList != null)
{
//Clears the state combo box contents.
for (var count = CityList.options.length-1; count >-1; count--)
{
CityList.options[count] = null;
}
}
//var stateNodes = statestring;
//alert("before arr");
var stateNodes = new Array();
stateNodes = statestring.split('/');
//alert("after arr");
var optionItem;
//Add new states list to the state combo box.
for (var count = 0; count < stateNodes.length-1; count++)
{
var stateValue = new Array();
var stname;
var stid;
stateValue = stateNodes[count].split(',');
//alert (stateValue);
stname =stateValue[0];
//alert (stname);
stid = stateValue[1];
//alert (stid);
//alert (stateValue[0]);
optionItem = new Option (stname, stid, false, false);
stateList.options[stateList.length] = optionItem;
alert(stateList.value);
}
}
//Gets called when state combo box selection changes
function StateListOnChange()
{
//alert ("state changed");
var statelist = document.getElementById("cmbState");
//Getting the selected country from country combo box.
var selectedItem = statelist.options[statelist.selectedIndex].value;
//document.getElementById("txtstateid").value=selectedItem;
//alert (selectedItem);
selectedItem= "S"+ selectedItem;
//var selectedItem = statelist.selectedIndex;
// URL to get states for a given country
var requestUrl = AjaxServerPageName + "?selectedItem=" + encodeURIComponent(selectedItem);
CreateXmlHttp();
// If browser supports XMLHTTPRequest object
if(XmlHttp)
{
//Setting the event handler for the response
XmlHttp.onreadystatechange = HandleResponse2;
//Initializes the request object with GET (METHOD of posting),
//Request URL and sets the request as asynchronous.
XmlHttp.open("GET", requestUrl, true);
//Sends the request to server
XmlHttp.send(null);
}
}
//Called when response comes back from server
function HandleResponse2()
{
// To make sure receiving response data from server is completed
if(XmlHttp.readyState == 4)
{
// To make sure valid response is received from the server, 200 means response received is OK
if(XmlHttp.status == 200)
{
//alert(XmlHttp.responseText);
ClearAndSetCityListItems(XmlHttp.responseText);
}
else
{
alert("There was a problem retrieving data from the server." );
}
}
}
//Clears the contents of City combo box and adds the states of currently selected country
function ClearAndSetCityListItems(statestring)
{
//alert("clear city = " + statestring);
var citylist = document.getElementById("cmbCity");
if (citylist != null )
{
//Clears the City combo box contents.
for (var count = citylist.options.length-1; count >-1; count--)
{
citylist.options[count] = null;
}
//var stateNodes = statestring;
var stateNodes = new Array();
stateNodes = statestring.split('/');
var optionItem;
//Add new City list to the state combo box.
for (var count = 0; count < stateNodes.length-1; count++)
{
var stateValue = new Array();
var stname;
var stid;
stateValue = stateNodes[count].split(',');
stname =stateValue[0];
stid = stateValue[1];
//stid=
//alert (stateValue[1]);
optionItem = new Option (stname, stid, false, false);
citylist.options[citylist.length] = optionItem;
}
}
}
function getCityId()
{
//alert("getcityid");
var statelist = document.getElementById("cmbCity");
var selectedItem = statelist.options[statelist.selectedIndex].value;
document.getElementById("txtcityid").value=selectedItem;
}
After selecting any state I am getting list cities in the city combo.But on my code behind page I am not getting the City Name and City ID.Folowing is the code:
Public Sub FillAllCombos()
Try
'Fill cmbState combo with all states
strSql = "Select StateID,StateName from StateMaster where IsActive = 1"
FillCombo(cmbState, strSql)
'Fill cmbContactType combo with Contact Type from MiscMaster
strSql = "Select MiscID,MiscName from MiscMaster where IsActive = 1 and MiscType='" & const_MISCTYPE_CONTACTTYPE & "'"
FillCombo(cmbContactType, strSql)
Catch ex As Exception
End Try
End Sub
Please help me in the following problem.
|
|
|
|
|
Can you please answer the following questions:
1) Currently, how are you trying to access the city values?
2) Can you show the markup for the city dropdown?
3) What is the error you are getting?
Shreekar
|
|
|
|
|
Hi,
I gave u the code.I am using Ajax for this.I got this code from net.
Thanks...
|
|
|
|
|
The code is either not enough/not all the code.
Also, I get the feeling that you have not understood the code you are usng - so how do you plan to maintain it or even make it work? I may be wrong though.
Anyhow, goto to HTML Source view in the VS 2005 and find out the HTML markup for the city dropdown. Copy paste that markup here. In your code, where and how are you trying to access the city dtopdown values? that also needs to be shown to analyse this.
Shreekar
|
|
|
|
|
Well I understood the code.
I said my problem that I dont get the Id and name of the city on my codebehind page.How do I get that as i am getting the value through script.
Thanks....
|
|
|
|
|
I will try for the last time:
Can you post here the HTML/ASPX markup for the city dropdown?
Shreekar
|
|
|
|
|
Dear All,
i am bit new to the dotnet world. i am making web application using asp.net ,C# (Visual studio 2005).
i have login form where i am using member class as
if (Membership.ValidateUser(Login1.UserName, EncryptingPassword(pswd)))
{
Response.Redirect("wizrd.aspx");
}
but i am getting error Could not find stored procedure 'dbo.aspnet_CheckSchemaVersion' . eventhough i have defined member as(Deleted defult member as)
<membership defaultprovider="SqlProvider" userisonlinetimewindow="20">
<providers>
<remove name="AspNetSqlProvider">
<add name="SqlProvider" type="System.Web.Security.SqlMembershipProvider" connectionstringname="databaseconnection" enablepasswordretrieval="false" enablepasswordreset="true" passwordformat="Hashed">
Can any one please tell where i am going wrong or totallly wrong . please tell me how to use the same
please guide
thanks
regards
imran khan
|
|
|
|
|
|
Thanks for reply but i read the artical .but it is of not much use.
as i have already implemented the same that is am using databaseconnection named sqlconnection which i am also using member.
thanks
regards
imran khan
|
|
|
|